diff options
Diffstat (limited to 'test/web')
| -rw-r--r-- | test/web/activity_pub/transmogrifier_test.exs | 24 | ||||
| -rw-r--r-- | test/web/mastodon_api/controllers/account_controller_test.exs | 27 | 
2 files changed, 51 insertions, 0 deletions
diff --git a/test/web/activity_pub/transmogrifier_test.exs b/test/web/activity_pub/transmogrifier_test.exs index 2914c90ea..3f908f867 100644 --- a/test/web/activity_pub/transmogrifier_test.exs +++ b/test/web/activity_pub/transmogrifier_test.exs @@ -260,6 +260,24 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do                 "<p>henlo from my Psion netBook</p><p>message sent from my Psion netBook</p>"      end +    test "it works for incoming honk announces" do +      _user = insert(:user, ap_id: "https://honktest/u/test", local: false) +      other_user = insert(:user) +      {:ok, post} = CommonAPI.post(other_user, %{"status" => "bonkeronk"}) + +      announce = %{ +        "@context" => "https://www.w3.org/ns/activitystreams", +        "actor" => "https://honktest/u/test", +        "id" => "https://honktest/u/test/bonk/1793M7B9MQ48847vdx", +        "object" => post.data["object"], +        "published" => "2019-06-25T19:33:58Z", +        "to" => "https://www.w3.org/ns/activitystreams#Public", +        "type" => "Announce" +      } + +      {:ok, %Activity{local: false}} = Transmogrifier.handle_incoming(announce) +    end +      test "it works for incoming announces with actor being inlined (kroeg)" do        data = File.read!("test/fixtures/kroeg-announce-with-inline-actor.json") |> Poison.decode!() @@ -815,6 +833,12 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do        follower = User.get_cached_by_id(follower.id)        assert User.following?(follower, followed) == true + +      follower = User.get_by_id(follower.id) +      assert follower.following_count == 1 + +      followed = User.get_by_id(followed.id) +      assert followed.follower_count == 1      end      test "it fails for incoming accepts which cannot be correlated" do diff --git a/test/web/mastodon_api/controllers/account_controller_test.exs b/test/web/mastodon_api/controllers/account_controller_test.exs index 256a8b304..0d48ae4ae 100644 --- a/test/web/mastodon_api/controllers/account_controller_test.exs +++ b/test/web/mastodon_api/controllers/account_controller_test.exs @@ -222,6 +222,33 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do    describe "user timelines" do      setup do: oauth_access(["read:statuses"]) +    test "works with announces that are just addressed to public", %{conn: conn} do +      user = insert(:user, ap_id: "https://honktest/u/test", local: false) +      other_user = insert(:user) + +      {:ok, post} = CommonAPI.post(other_user, %{"status" => "bonkeronk"}) + +      {:ok, announce, _} = +        %{ +          "@context" => "https://www.w3.org/ns/activitystreams", +          "actor" => "https://honktest/u/test", +          "id" => "https://honktest/u/test/bonk/1793M7B9MQ48847vdx", +          "object" => post.data["object"], +          "published" => "2019-06-25T19:33:58Z", +          "to" => ["https://www.w3.org/ns/activitystreams#Public"], +          "type" => "Announce" +        } +        |> ActivityPub.persist(local: false) + +      assert resp = +               conn +               |> get("/api/v1/accounts/#{user.id}/statuses") +               |> json_response_and_validate_schema(200) + +      assert [%{"id" => id}] = resp +      assert id == announce.id +    end +      test "respects blocks", %{user: user_one, conn: conn} do        user_two = insert(:user)        user_three = insert(:user)  | 
