X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fweb%2Fostatus%2Fostatus_test.exs;h=8dd3c3b54c65d77a8cf50a772ad92c1636191246;hb=51dc2b1696ee4d2c444b4809a1859379af6e3bc8;hp=34bfaa005261d4f41ac28a10dfc983df67611aa2;hpb=6a44427915098e45a6e27cccabe149d4cfcb3b7a;p=akkoma diff --git a/test/web/ostatus/ostatus_test.exs b/test/web/ostatus/ostatus_test.exs index 34bfaa005..8dd3c3b54 100644 --- a/test/web/ostatus/ostatus_test.exs +++ b/test/web/ostatus/ostatus_test.exs @@ -15,6 +15,8 @@ defmodule Pleroma.Web.OStatusTest do incoming = File.read!("test/fixtures/incoming_note_activity.xml") {:ok, [activity]} = OStatus.handle_incoming(incoming) + user = User.get_by_ap_id(activity.data["actor"]) + assert user.info["note_count"] == 1 assert activity.data["type"] == "Create" assert activity.data["object"]["type"] == "Note" assert activity.data["object"]["id"] == "tag:gs.example.org:4040,2017-04-23:noticeId=29:objectType=note" @@ -324,11 +326,18 @@ defmodule Pleroma.Web.OStatusTest do 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 @@ -337,4 +346,11 @@ defmodule Pleroma.Web.OStatusTest 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