1 defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
3 alias Pleroma.Web.ActivityPub.Transmogrifier
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!
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"
18 assert data["actor"] == "http://mastodon.example.org/users/admin"
20 object = data["object"]
21 assert object["id"] == "http://mastodon.example.org/users/admin/statuses/99512778738411822"
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"
28 assert object["actor"] == "http://mastodon.example.org/users/admin"
29 assert object["attributedTo"] == "http://mastodon.example.org/users/admin"