Admin chat api tests: Small additions.
authorlain <lain@soykaf.club>
Thu, 17 Sep 2020 11:29:26 +0000 (13:29 +0200)
committerlain <lain@soykaf.club>
Thu, 17 Sep 2020 11:29:26 +0000 (13:29 +0200)
test/web/admin_api/controllers/admin_api_controller_test.exs
test/web/admin_api/controllers/chat_controller_test.exs

index 3476fd0b41c97e9b1b24a34ead2cf53df481feaa..e6ad210a2003f896a842f37a62016be2ccee922d 100644 (file)
@@ -1521,7 +1521,7 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
       %{user: user}
     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")
 
       assert json_response(conn, 200) |> length() == 3
index e81484ce62f8de8cb9b38d8b99cdeb8bf4853369..bd4c9c9d15d0a30f5e3474c41b9b9cac99a17d5a 100644 (file)
@@ -40,8 +40,10 @@ defmodule Pleroma.Web.AdminAPI.ChatControllerTest do
       object = Object.normalize(message, false)
 
       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)
+      recipient_cm_ref = MessageReference.for_chat_and_object(recipient_chat, object)
 
       result =
         conn
@@ -56,6 +58,7 @@ defmodule Pleroma.Web.AdminAPI.ChatControllerTest do
 
       assert result["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)
     end
   end