assert activity.data["object"]["published"] == "2017-04-23T14:51:03+00:00"
assert activity.data["context"] == "tag:gs.example.org:4040,2017-04-23:objectType=thread:nonce=f09e22f58abd5c7b"
assert "http://pleroma.example.org:4000/users/lain3" in activity.data["to"]
+ assert activity.data["object"]["emoji"] == %{ "marko" => "marko.png", "reimu" => "reimu.png" }
assert activity.local == false
end
refute favorited_activity.local
end
+ test "handle conversation references" do
+ incoming = File.read!("test/fixtures/mastodon_conversation.xml")
+ {:ok, [activity]} = OStatus.handle_incoming(incoming)
+
+ assert activity.data["context"] == "tag:mastodon.social,2017-08-28:objectId=7876885:objectType=Conversation"
+ end
+
test "handle incoming favorites with locally available object - GS, websub" do
note_activity = insert(:note_activity)
describe "fetching a status by it's HTML url" do
test "it builds a missing status from an html url" do
url = "https://shitposter.club/notice/2827873"
- {:ok, [activity] } = OStatus.fetch_activity_from_html_url(url)
+ {:ok, [activity] } = OStatus.fetch_activity_from_url(url)
assert activity.data["actor"] == "https://shitposter.club/user/1"
assert activity.data["object"]["id"] == "tag:shitposter.club,2017-05-05:noticeId=2827873:objectType=comment"
end
+
+ test "it works for atom notes, too" do
+ url = "https://social.sakamoto.gq/objects/0ccc1a2c-66b0-4305-b23a-7f7f2b040056"
+ {:ok, [activity] } = OStatus.fetch_activity_from_url(url)
+ assert activity.data["actor"] == "https://social.sakamoto.gq/users/eal"
+ assert activity.data["object"]["id"] == url
+ end
end
test "insert or update a user from given data" do
assert {:ok, %User{}} = OStatus.insert_or_update_user(data)
end
+
+ test "it doesn't add nil in the do field" do
+ incoming = File.read!("test/fixtures/nil_mention_entry.xml")
+ {:ok, [activity]} = OStatus.handle_incoming(incoming)
+
+ assert activity.data["to"] == ["http://localhost:4001/users/atarifrosch@social.stopwatchingus-heidelberg.de/followers", "https://www.w3.org/ns/activitystreams#Public"]
+ end
end