summaryrefslogtreecommitdiff
path: root/test/web/streamer/streamer_test.exs
diff options
context:
space:
mode:
authorIvan Tashkinov <ivantashkinov@gmail.com>2020-04-22 20:00:51 +0300
committerIvan Tashkinov <ivantashkinov@gmail.com>2020-04-22 20:00:51 +0300
commite7fb593d130e0ad62e3690dce4a0913fe3d40ef0 (patch)
tree8edbc679acda1e5e024884c12cbceb2509417033 /test/web/streamer/streamer_test.exs
parentb03aeae8b935b0a211c51cc3be5f1c15591f5a2f (diff)
parent28f8fcf8b034223209ec451d0c2c836124ec93f4 (diff)
downloadpleroma-e7fb593d130e0ad62e3690dce4a0913fe3d40ef0.tar.gz
pleroma-e7fb593d130e0ad62e3690dce4a0913fe3d40ef0.zip
Merge remote-tracking branch 'remotes/origin/develop' into 1364-no-pushes-from-blocked-domains-users
# Conflicts: # CHANGELOG.md
Diffstat (limited to 'test/web/streamer/streamer_test.exs')
-rw-r--r--test/web/streamer/streamer_test.exs36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/web/streamer/streamer_test.exs b/test/web/streamer/streamer_test.exs
index eb082b79f..8b8d8af6c 100644
--- a/test/web/streamer/streamer_test.exs
+++ b/test/web/streamer/streamer_test.exs
@@ -28,6 +28,42 @@ defmodule Pleroma.Web.StreamerTest do
{:ok, %{user: user, notify: notify}}
end
+ test "it streams the user's post in the 'user' stream", %{user: user} do
+ task =
+ Task.async(fn ->
+ assert_receive {:text, _}, @streamer_timeout
+ end)
+
+ Streamer.add_socket(
+ "user",
+ %{transport_pid: task.pid, assigns: %{user: user}}
+ )
+
+ {:ok, activity} = CommonAPI.post(user, %{"status" => "hey"})
+
+ Streamer.stream("user", activity)
+ Task.await(task)
+ end
+
+ test "it streams boosts of the user in the 'user' stream", %{user: user} do
+ task =
+ Task.async(fn ->
+ assert_receive {:text, _}, @streamer_timeout
+ end)
+
+ Streamer.add_socket(
+ "user",
+ %{transport_pid: task.pid, assigns: %{user: user}}
+ )
+
+ other_user = insert(:user)
+ {:ok, activity} = CommonAPI.post(other_user, %{"status" => "hey"})
+ {:ok, announce, _} = CommonAPI.repeat(activity.id, user)
+
+ Streamer.stream("user", announce)
+ Task.await(task)
+ end
+
test "it sends notify to in the 'user' stream", %{user: user, notify: notify} do
task =
Task.async(fn ->