Explain the encode-decode roundtrip
This commit is contained in:
parent
3e7d2e29b3
commit
eb33a03d0a
@ -38,6 +38,13 @@ defmodule Pleroma.Integration.MastodonWebsocketTest do
|
|||||||
end
|
end
|
||||||
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
|
test "refuses invalid requests" do
|
||||||
capture_log(fn ->
|
capture_log(fn ->
|
||||||
assert {:error, %WebSockex.RequestError{code: 404}} = start_socket("?stream=ncjdk")
|
assert {:error, %WebSockex.RequestError{code: 404}} = start_socket("?stream=ncjdk")
|
||||||
@ -80,8 +87,7 @@ defmodule Pleroma.Integration.MastodonWebsocketTest do
|
|||||||
|
|
||||||
view_json =
|
view_json =
|
||||||
Pleroma.Web.MastodonAPI.StatusView.render("show.json", activity: activity, for: nil)
|
Pleroma.Web.MastodonAPI.StatusView.render("show.json", activity: activity, for: nil)
|
||||||
|> Jason.encode!()
|
|> atom_key_to_string()
|
||||||
|> Jason.decode!()
|
|
||||||
|
|
||||||
assert json == view_json
|
assert json == view_json
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user