Admin chat api tests: Small additions.
This commit is contained in:
parent
7a73850928
commit
e39ff2616b
|
@ -1521,7 +1521,7 @@ test "excludes reblogs by default", %{conn: conn, user: user} do
|
||||||
%{user: user}
|
%{user: user}
|
||||||
end
|
end
|
||||||
|
|
||||||
test "renders user's statuses", %{conn: conn, user: user} do
|
test "renders user's chats", %{conn: conn, user: user} do
|
||||||
conn = get(conn, "/api/pleroma/admin/users/#{user.nickname}/chats")
|
conn = get(conn, "/api/pleroma/admin/users/#{user.nickname}/chats")
|
||||||
|
|
||||||
assert json_response(conn, 200) |> length() == 3
|
assert json_response(conn, 200) |> length() == 3
|
||||||
|
|
|
@ -40,8 +40,10 @@ test "it deletes a message from the chat", %{conn: conn, admin: admin} do
|
||||||
object = Object.normalize(message, false)
|
object = Object.normalize(message, false)
|
||||||
|
|
||||||
chat = Chat.get(user.id, recipient.ap_id)
|
chat = Chat.get(user.id, recipient.ap_id)
|
||||||
|
recipient_chat = Chat.get(recipient.id, user.ap_id)
|
||||||
|
|
||||||
cm_ref = MessageReference.for_chat_and_object(chat, object)
|
cm_ref = MessageReference.for_chat_and_object(chat, object)
|
||||||
|
recipient_cm_ref = MessageReference.for_chat_and_object(recipient_chat, object)
|
||||||
|
|
||||||
result =
|
result =
|
||||||
conn
|
conn
|
||||||
|
@ -56,6 +58,7 @@ test "it deletes a message from the chat", %{conn: conn, admin: admin} do
|
||||||
|
|
||||||
assert result["id"] == cm_ref.id
|
assert result["id"] == cm_ref.id
|
||||||
refute MessageReference.get_by_id(cm_ref.id)
|
refute MessageReference.get_by_id(cm_ref.id)
|
||||||
|
refute MessageReference.get_by_id(recipient_cm_ref.id)
|
||||||
assert %{data: %{"type" => "Tombstone"}} = Object.get_by_id(object.id)
|
assert %{data: %{"type" => "Tombstone"}} = Object.get_by_id(object.id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue