269429359e986e51deaa619a2879015e392e0058
[akkoma] / test / web / activity_pub / transmogrifier_test.exs
1 defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
2 use Pleroma.DataCase
3 alias Pleroma.Web.ActivityPub.Transmogrifier
4 alias Pleroma.Activity
5
6 describe "handle_incoming" do
7 test "it works for incoming notices" do
8 data = File.read!("test/fixtures/mastodon-post-activity.json") |> Poison.decode!
9
10 {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
11 assert data["id"] == "http://mastodon.example.org/users/admin/statuses/99512778738411822/activity"
12 assert data["context"] == "tag:mastodon.example.org,2018-02-12:objectId=20:objectType=Conversation"
13 assert data["to"] == ["https://www.w3.org/ns/activitystreams#Public"]
14 assert data["cc"] == [
15 "http://mastodon.example.org/users/admin/followers",
16 "http://localtesting.pleroma.lol/users/lain"
17 ]
18 assert data["actor"] == "http://mastodon.example.org/users/admin"
19
20 object = data["object"]
21 assert object["id"] == "http://mastodon.example.org/users/admin/statuses/99512778738411822"
22
23 assert object["to"] == ["https://www.w3.org/ns/activitystreams#Public"]
24 assert object["cc"] == [
25 "http://mastodon.example.org/users/admin/followers",
26 "http://localtesting.pleroma.lol/users/lain"
27 ]
28 assert object["actor"] == "http://mastodon.example.org/users/admin"
29 assert object["attributedTo"] == "http://mastodon.example.org/users/admin"
30 end
31 end
32 end