diff options
author | tusooa <tusooa@kazv.moe> | 2023-07-18 18:13:49 -0400 |
---|---|---|
committer | tusooa <tusooa@kazv.moe> | 2023-08-31 18:27:58 -0400 |
commit | 7f8d72e9093131963fd4786a597c7cf3ed2b2e78 (patch) | |
tree | 6348478a94ba153b8e0e281e0778978fee315e07 | |
parent | e6cfd6f8c1a724f4baa2992afbbf75fcf0ee31d3 (diff) |
Explain the encode-decode roundtriptusooa/3018-unified-stream
-rw-r--r-- | test/pleroma/integration/mastodon_websocket_test.exs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/test/pleroma/integration/mastodon_websocket_test.exs b/test/pleroma/integration/mastodon_websocket_test.exs index 7d5dfc255..a2c20f0a6 100644 --- a/test/pleroma/integration/mastodon_websocket_test.exs +++ b/test/pleroma/integration/mastodon_websocket_test.exs @@ -38,6 +38,13 @@ defmodule Pleroma.Integration.MastodonWebsocketTest do end end + # Turns atom keys to strings + defp atom_key_to_string(json) do + json + |> Jason.encode!() + |> Jason.decode!() + end + test "refuses invalid requests" do capture_log(fn -> assert {:error, %WebSockex.RequestError{code: 404}} = start_socket("?stream=ncjdk") @@ -80,8 +87,7 @@ defmodule Pleroma.Integration.MastodonWebsocketTest do view_json = Pleroma.Web.MastodonAPI.StatusView.render("show.json", activity: activity, for: nil) - |> Jason.encode!() - |> Jason.decode!() + |> atom_key_to_string() assert json == view_json end |