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
f0a8d723
Commit
f0a8d723
authored
Aug 18, 2020
by
lain
Browse files
Transmogrifier Test: Extract audio tests.
parent
3998ef9d
Pipeline
#29901
failed with stages
in 30 minutes and 1 second
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
test/web/activity_pub/transmogrifier/audio_handling_test.exs
0 → 100644
View file @
f0a8d723
# Pleroma: A lightweight social networking server
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule
Pleroma
.
Web
.
ActivityPub
.
Transmogrifier
.
AudioHandlingTest
do
use
Oban
.
Testing
,
repo:
Pleroma
.
Repo
use
Pleroma
.
DataCase
alias
Pleroma
.
Activity
alias
Pleroma
.
Object
alias
Pleroma
.
Web
.
ActivityPub
.
Transmogrifier
import
Pleroma
.
Factory
test
"it works for incoming listens"
do
_user
=
insert
(
:user
,
ap_id:
"http://mastodon.example.org/users/admin"
)
data
=
%{
"@context"
=>
"https://www.w3.org/ns/activitystreams"
,
"to"
=>
[
"https://www.w3.org/ns/activitystreams#Public"
],
"cc"
=>
[],
"type"
=>
"Listen"
,
"id"
=>
"http://mastodon.example.org/users/admin/listens/1234/activity"
,
"actor"
=>
"http://mastodon.example.org/users/admin"
,
"object"
=>
%{
"type"
=>
"Audio"
,
"id"
=>
"http://mastodon.example.org/users/admin/listens/1234"
,
"attributedTo"
=>
"http://mastodon.example.org/users/admin"
,
"title"
=>
"lain radio episode 1"
,
"artist"
=>
"lain"
,
"album"
=>
"lain radio"
,
"length"
=>
180_000
}
}
{
:ok
,
%
Activity
{
local:
false
}
=
activity
}
=
Transmogrifier
.
handle_incoming
(
data
)
object
=
Object
.
normalize
(
activity
)
assert
object
.
data
[
"title"
]
==
"lain radio episode 1"
assert
object
.
data
[
"artist"
]
==
"lain"
assert
object
.
data
[
"album"
]
==
"lain radio"
assert
object
.
data
[
"length"
]
==
180_000
end
end
test/web/activity_pub/transmogrifier_test.exs
View file @
f0a8d723
...
...
@@ -225,35 +225,6 @@ test "it works for incoming notices with hashtags" do
assert
Enum
.
at
(
object
.
data
[
"tag"
],
2
)
==
"moo"
end
test
"it works for incoming listens"
do
data
=
%{
"@context"
=>
"https://www.w3.org/ns/activitystreams"
,
"to"
=>
[
"https://www.w3.org/ns/activitystreams#Public"
],
"cc"
=>
[],
"type"
=>
"Listen"
,
"id"
=>
"http://mastodon.example.org/users/admin/listens/1234/activity"
,
"actor"
=>
"http://mastodon.example.org/users/admin"
,
"object"
=>
%{
"type"
=>
"Audio"
,
"id"
=>
"http://mastodon.example.org/users/admin/listens/1234"
,
"attributedTo"
=>
"http://mastodon.example.org/users/admin"
,
"title"
=>
"lain radio episode 1"
,
"artist"
=>
"lain"
,
"album"
=>
"lain radio"
,
"length"
=>
180_000
}
}
{
:ok
,
%
Activity
{
local:
false
}
=
activity
}
=
Transmogrifier
.
handle_incoming
(
data
)
object
=
Object
.
normalize
(
activity
)
assert
object
.
data
[
"title"
]
==
"lain radio episode 1"
assert
object
.
data
[
"artist"
]
==
"lain"
assert
object
.
data
[
"album"
]
==
"lain radio"
assert
object
.
data
[
"length"
]
==
180_000
end
test
"it works for incoming notices with contentMap"
do
data
=
File
.
read!
(
"test/fixtures/mastodon-post-activity-contentmap.json"
)
|>
Poison
.
decode!
()
...
...
Write
Preview
Markdown
is supported
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