diff options
author | kaniini <nenolod@gmail.com> | 2018-11-25 02:54:54 +0000 |
---|---|---|
committer | kaniini <nenolod@gmail.com> | 2018-11-25 02:54:54 +0000 |
commit | 39a3b1724ad5bf5828142d4e83d7cb2bbb45a0d9 (patch) | |
tree | a0f834316f6528cada1a543c270afbf8651c86c1 /test | |
parent | 675653ceb78e4a64d8375904e555cdd62f064e21 (diff) | |
parent | cc8952b45fc9c8d77f1d7c83674d4194b032c5fd (diff) | |
download | pleroma-39a3b1724ad5bf5828142d4e83d7cb2bbb45a0d9.tar.gz |
Merge branch 'bugfix/public-mastoapi-websocket' into 'develop'
Web.MastodonAPI.MastodonSocket: Add unauthentified websocket endpoints
See merge request pleroma/pleroma!471
Diffstat (limited to 'test')
-rw-r--r-- | test/web/mastodon_api/mastodon_socket_test.exs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/web/mastodon_api/mastodon_socket_test.exs b/test/web/mastodon_api/mastodon_socket_test.exs new file mode 100644 index 000000000..c7d71defc --- /dev/null +++ b/test/web/mastodon_api/mastodon_socket_test.exs @@ -0,0 +1,33 @@ +defmodule Pleroma.Web.MastodonApi.MastodonSocketTest do + use Pleroma.DataCase + + alias Pleroma.Web.MastodonApi.MastodonSocket + alias Pleroma.Web.{Streamer, CommonAPI} + alias Pleroma.User + + import Pleroma.Factory + + test "public is working when non-authenticated" do + user = insert(:user) + + task = + Task.async(fn -> + assert_receive {:text, _}, 4_000 + end) + + fake_socket = %{ + transport_pid: task.pid, + assigns: %{} + } + + topics = %{ + "public" => [fake_socket] + } + + {:ok, activity} = CommonAPI.post(user, %{"status" => "Test"}) + + Streamer.push_to_socket(topics, "public", activity) + + Task.await(task) + end +end |