diff options
author | Ivan Tashkinov <ivantashkinov@gmail.com> | 2020-04-22 18:51:59 +0300 |
---|---|---|
committer | Ivan Tashkinov <ivantashkinov@gmail.com> | 2020-04-22 18:51:59 +0300 |
commit | 0062116e07446beea13768d122e5bcb19c60dde7 (patch) | |
tree | 2c050be2e440364824680fdff3c4499daf118dee /test/web/streamer/streamer_test.exs | |
parent | 2958a7d246f40141a88bcb7bdd6a477c4f65f0bc (diff) | |
parent | 28f8fcf8b034223209ec451d0c2c836124ec93f4 (diff) | |
download | pleroma-0062116e07446beea13768d122e5bcb19c60dde7.tar.gz pleroma-0062116e07446beea13768d122e5bcb19c60dde7.zip |
Merge remote-tracking branch 'remotes/origin/develop' into automatic-authentication-and-instance-publicity-checks
# Conflicts:
# lib/pleroma/web/mastodon_api/controllers/account_controller.ex
Diffstat (limited to 'test/web/streamer/streamer_test.exs')
-rw-r--r-- | test/web/streamer/streamer_test.exs | 36 |
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 -> |