fix case when tags is invalid
[akkoma] / test / web / mastodon_api / mastodon_socket_test.exs
1 defmodule Pleroma.Web.MastodonApi.MastodonSocketTest do
2 use Pleroma.DataCase
3
4 alias Pleroma.Web.{Streamer, CommonAPI}
5
6 import Pleroma.Factory
7
8 test "public is working when non-authenticated" do
9 user = insert(:user)
10
11 task =
12 Task.async(fn ->
13 assert_receive {:text, _}, 4_000
14 end)
15
16 fake_socket = %{
17 transport_pid: task.pid,
18 assigns: %{}
19 }
20
21 topics = %{
22 "public" => [fake_socket]
23 }
24
25 {:ok, activity} = CommonAPI.post(user, %{"status" => "Test"})
26
27 Streamer.push_to_socket(topics, "public", activity)
28
29 Task.await(task)
30 end
31 end