Add test for stream boosts of mastodon user
authorkPherox <admin@mail.kr-kp.com>
Fri, 29 May 2020 12:08:09 +0000 (21:08 +0900)
committerkPherox <admin@mail.kr-kp.com>
Fri, 29 May 2020 15:31:20 +0000 (00:31 +0900)
test/web/streamer/streamer_test.exs

index cb4595bb61da387336ac4a782fd32dbd49b75c01..4cf640ce8a4b3f2cc050deccdefc576e7f5f636e 100644 (file)
@@ -112,6 +112,25 @@ defmodule Pleroma.Web.StreamerTest do
       refute Streamer.filtered_by_user?(user, announce)
     end
 
+    test "it streams boosts of mastodon user in the 'user' stream", %{user: user} do
+      Streamer.get_topic_and_add_socket("user", user)
+
+      other_user = insert(:user)
+      {:ok, activity} = CommonAPI.post(other_user, %{status: "hey"})
+
+      data =
+        File.read!("test/fixtures/mastodon-announce.json")
+        |> Poison.decode!()
+        |> Map.put("object", activity.data["object"])
+        |> Map.put("actor", user.ap_id)
+
+      {:ok, %Pleroma.Activity{data: data, local: false} = announce} =
+        Pleroma.Web.ActivityPub.Transmogrifier.handle_incoming(data)
+
+      assert_receive {:render_with_user, Pleroma.Web.StreamerView, "update.json", ^announce}
+      refute Streamer.filtered_by_user?(user, announce)
+    end
+
     test "it sends notify to in the 'user' stream", %{user: user, notify: notify} do
       Streamer.get_topic_and_add_socket("user", user)
       Streamer.stream("user", notify)