diff options
author | Roger Braun <roger@rogerbraun.net> | 2017-05-10 18:46:23 +0200 |
---|---|---|
committer | Roger Braun <roger@rogerbraun.net> | 2017-05-10 18:46:23 +0200 |
commit | 05f2cd0d930e93d1eb80a8a4ba3952f8ba46f5ce (patch) | |
tree | 752c9bddc7ccfbf738439a8b9ea4ead878d4c7c2 /test/web | |
parent | 34a1ce00ecc6f19827638fc311e4e76d3c4cb162 (diff) | |
download | pleroma-05f2cd0d930e93d1eb80a8a4ba3952f8ba46f5ce.tar.gz pleroma-05f2cd0d930e93d1eb80a8a4ba3952f8ba46f5ce.zip |
Handle incoming follows.
Also Mastodon CWs.
Diffstat (limited to 'test/web')
-rw-r--r-- | test/web/ostatus/ostatus_test.exs | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/test/web/ostatus/ostatus_test.exs b/test/web/ostatus/ostatus_test.exs index 39f299ab4..b326dc0a0 100644 --- a/test/web/ostatus/ostatus_test.exs +++ b/test/web/ostatus/ostatus_test.exs @@ -62,6 +62,16 @@ defmodule Pleroma.Web.OStatusTest do assert activity.data["context"] == "2hu" end + test "handle incoming notes - Mastodon, with CW" do + incoming = File.read!("test/fixtures/mastodon-note-cw.xml") + {:ok, [activity]} = OStatus.handle_incoming(incoming) + + assert activity.data["type"] == "Create" + assert activity.data["object"]["type"] == "Note" + assert activity.data["object"]["actor"] == "https://mastodon.social/users/lambadalambda" + assert String.contains?(activity.data["object"]["content"], "technologic") + end + test "handle incoming notes - GS, subscription, reply" do incoming = File.read!("test/fixtures/ostatus_incoming_reply.xml") {:ok, [activity]} = OStatus.handle_incoming(incoming) @@ -172,6 +182,21 @@ defmodule Pleroma.Web.OStatusTest do assert activity.data["object"]["id"] == "tag:gs.example.org:4040,2017-04-25:noticeId=55:objectType=note" end + test "handle incoming follows" do + incoming = File.read!("test/fixtures/follow.xml") + {:ok, [activity]} = OStatus.handle_incoming(incoming) + assert activity.data["type"] == "Follow" + assert activity.data["id"] == "tag:social.heldscal.la,2017-05-07:subscription:23211:person:44803:2017-05-07T09:54:48+00:00" + assert activity.data["actor"] == "https://social.heldscal.la/user/23211" + assert activity.data["object"] == "https://pawoo.net/users/pekorino" + refute activity.local + + follower = User.get_cached_by_ap_id(activity.data["actor"]) + followed = User.get_cached_by_ap_id(activity.data["object"]) + + assert User.following?(follower, followed) + end + describe "new remote user creation" do test "returns local users" do local_user = insert(:user) @@ -270,6 +295,6 @@ defmodule Pleroma.Web.OStatusTest do 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 + end end end |