mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-23 00:26:30 +00:00
Add test to cover rendering update with user
This commit is contained in:
parent
050227f118
commit
4cf109d3c4
1 changed files with 27 additions and 0 deletions
|
@ -406,5 +406,32 @@ defmodule Pleroma.Integration.MastodonWebsocketTest do
|
|||
assert_receive {:close, _}
|
||||
refute_receive {:close, _}
|
||||
end
|
||||
|
||||
test "receives private statuses", %{user: reading_user, token: token} do
|
||||
user = insert(:user)
|
||||
CommonAPI.follow(reading_user, user)
|
||||
|
||||
{:ok, _} = start_socket("?stream=user&access_token=#{token.token}")
|
||||
|
||||
{:ok, activity} =
|
||||
CommonAPI.post(user, %{status: "nice echo chamber", visibility: "private"})
|
||||
|
||||
assert_receive {:text, raw_json}, 1_000
|
||||
assert {:ok, json} = Jason.decode(raw_json)
|
||||
|
||||
assert "update" == json["event"]
|
||||
assert json["payload"]
|
||||
assert {:ok, json} = Jason.decode(json["payload"])
|
||||
|
||||
view_json =
|
||||
Pleroma.Web.MastodonAPI.StatusView.render("show.json",
|
||||
activity: activity,
|
||||
for: reading_user
|
||||
)
|
||||
|> Jason.encode!()
|
||||
|> Jason.decode!()
|
||||
|
||||
assert json == view_json
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue