Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pleroma
pleroma
Commits
455bb526
Commit
455bb526
authored
Mar 19, 2019
by
kaniini
Browse files
test: add test for list sanitization
parent
fd0aa58e
Changes
1
Hide whitespace changes
Inline
Side-by-side
test/web/activity_pub/transmogrifier_test.exs
View file @
455bb526
...
...
@@ -358,6 +358,30 @@ test "it ensures that as:Public activities make it to their followers collection
assert
data
[
"cc"
]
==
[
User
.
ap_followers
(
user
)]
end
test
"it ensures that address fields become lists"
do
user
=
insert
(
:user
)
data
=
File
.
read!
(
"test/fixtures/mastodon-post-activity.json"
)
|>
Poison
.
decode!
()
|>
Map
.
put
(
"actor"
,
user
.
ap_id
)
|>
Map
.
put
(
"to"
,
nil
)
|>
Map
.
put
(
"cc"
,
nil
)
object
=
data
[
"object"
]
|>
Map
.
put
(
"attributedTo"
,
user
.
ap_id
)
|>
Map
.
put
(
"to"
,
nil
)
|>
Map
.
put
(
"cc"
,
nil
)
data
=
Map
.
put
(
data
,
"object"
,
object
)
{
:ok
,
%
Activity
{
data:
data
,
local:
false
}}
=
Transmogrifier
.
handle_incoming
(
data
)
assert
!is_nil
(
data
[
"to"
])
assert
!is_nil
(
data
[
"cc"
])
end
test
"it works for incoming update activities"
do
data
=
File
.
read!
(
"test/fixtures/mastodon-post-activity.json"
)
|>
Poison
.
decode!
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment