summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/web/mastodon_api/mastodon_api_controller_test.exs21
1 files changed, 19 insertions, 2 deletions
diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs
index 5293b9364..432dca28a 100644
--- a/test/web/mastodon_api/mastodon_api_controller_test.exs
+++ b/test/web/mastodon_api/mastodon_api_controller_test.exs
@@ -63,9 +63,12 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
test "posting a status", %{conn: conn} do
user = insert(:user)
- conn =
+ idempotency_key = "Pikachu rocks!"
+
+ conn_one =
conn
|> assign(:user, user)
+ |> put_req_header("idempotency-key", idempotency_key)
|> post("/api/v1/statuses", %{
"status" => "cofe",
"spoiler_text" => "2hu",
@@ -73,9 +76,23 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
})
assert %{"content" => "cofe", "id" => id, "spoiler_text" => "2hu", "sensitive" => false} =
- json_response(conn, 200)
+ json_response(conn_one, 200)
assert Repo.get(Activity, id)
+
+ conn_two =
+ conn
+ |> assign(:user, user)
+ |> put_req_header("idempotency-key", idempotency_key)
+ |> post("/api/v1/statuses", %{
+ "status" => "cofe",
+ "spoiler_text" => "2hu",
+ "sensitive" => "false"
+ })
+
+ assert %{"id" => second_id} = json_response(conn_two, 200)
+
+ assert id == second_id
end
test "posting a sensitive status", %{conn: conn} do