diff options
Diffstat (limited to 'test')
3 files changed, 9 insertions, 2 deletions
diff --git a/test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs index 6381f9757..fa6b9db65 100644 --- a/test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs @@ -82,11 +82,13 @@ defmodule Pleroma.Web.PleromaAPI.ChatControllerTest do        result =          conn          |> put_req_header("content-type", "application/json") +        |> put_req_header("idempotency-key", "123")          |> post("/api/v1/pleroma/chats/#{chat.id}/messages", %{"content" => "Hallo!!"})          |> json_response_and_validate_schema(200)        assert result["content"] == "Hallo!!"        assert result["chat_id"] == chat.id |> to_string() +      assert result["idempotency_key"] == "123"      end      test "it fails if there is no content", %{conn: conn, user: user} do diff --git a/test/pleroma/web/pleroma_api/views/chat_message_reference_view_test.exs b/test/pleroma/web/pleroma_api/views/chat_message_reference_view_test.exs index f171a1e55..ae8257870 100644 --- a/test/pleroma/web/pleroma_api/views/chat_message_reference_view_test.exs +++ b/test/pleroma/web/pleroma_api/views/chat_message_reference_view_test.exs @@ -25,7 +25,9 @@ defmodule Pleroma.Web.PleromaAPI.ChatMessageReferenceViewTest do      }      {:ok, upload} = ActivityPub.upload(file, actor: user.ap_id) -    {:ok, activity} = CommonAPI.post_chat_message(user, recipient, "kippis :firefox:") + +    {:ok, activity} = +      CommonAPI.post_chat_message(user, recipient, "kippis :firefox:", idempotency_key: "123")      chat = Chat.get(user.id, recipient.ap_id) @@ -42,6 +44,7 @@ defmodule Pleroma.Web.PleromaAPI.ChatMessageReferenceViewTest do      assert chat_message[:created_at]      assert chat_message[:unread] == false      assert match?([%{shortcode: "firefox"}], chat_message[:emojis]) +    assert chat_message[:idempotency_key] == "123"      clear_config([:rich_media, :enabled], true) diff --git a/test/pleroma/web/streamer_test.exs b/test/pleroma/web/streamer_test.exs index 185724a9f..395016da2 100644 --- a/test/pleroma/web/streamer_test.exs +++ b/test/pleroma/web/streamer_test.exs @@ -255,7 +255,9 @@ defmodule Pleroma.Web.StreamerTest do      } do        other_user = insert(:user) -      {:ok, create_activity} = CommonAPI.post_chat_message(other_user, user, "hey cirno") +      {:ok, create_activity} = +        CommonAPI.post_chat_message(other_user, user, "hey cirno", idempotency_key: "123") +        object = Object.normalize(create_activity, false)        chat = Chat.get(user.id, other_user.ap_id)        cm_ref = MessageReference.for_chat_and_object(chat, object)  | 
