X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fplugs%2Fidempotency_plug_test.exs;h=21fa0fbcf40a62009604062e2bf193465765b188;hb=d96139f78924c5607cd218ea5432a9b80a6301ea;hp=aebc463e9dee24dcfb4ed4f557361b25f8a3dfc0;hpb=825077a5b0dc0c90d93bc94ae83398c4f68d0003;p=akkoma diff --git a/test/plugs/idempotency_plug_test.exs b/test/plugs/idempotency_plug_test.exs index aebc463e9..21fa0fbcf 100644 --- a/test/plugs/idempotency_plug_test.exs +++ b/test/plugs/idempotency_plug_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2019 Pleroma Authors +# Copyright © 2017-2020 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Plugs.IdempotencyPlugTest do @@ -24,7 +24,7 @@ defmodule Pleroma.Plugs.IdempotencyPlugTest do |> IdempotencyPlug.call([]) |> Conn.send_resp(status, body) - conn2 = + conn = :post |> conn("/cofe") |> put_req_header("idempotency-key", key) @@ -33,17 +33,17 @@ defmodule Pleroma.Plugs.IdempotencyPlugTest do |> IdempotencyPlug.call([]) assert_raise Conn.AlreadySentError, fn -> - Conn.send_resp(conn2, :im_a_teapot, "no cofe") + Conn.send_resp(conn, :im_a_teapot, "no cofe") end - assert conn2.resp_body == body - assert conn2.status == status + assert conn.resp_body == body + assert conn.status == status - assert [^second_request_id] = Conn.get_resp_header(conn2, "x-request-id") - assert [^orig_request_id] = Conn.get_resp_header(conn2, "x-original-request-id") - assert [^key] = Conn.get_resp_header(conn2, "idempotency-key") - assert ["true"] = Conn.get_resp_header(conn2, "idempotent-replayed") - assert ["application/json; charset=utf-8"] = Conn.get_resp_header(conn2, "content-type") + assert [^second_request_id] = Conn.get_resp_header(conn, "x-request-id") + assert [^orig_request_id] = Conn.get_resp_header(conn, "x-original-request-id") + assert [^key] = Conn.get_resp_header(conn, "idempotency-key") + assert ["true"] = Conn.get_resp_header(conn, "idempotent-replayed") + assert ["application/json; charset=utf-8"] = Conn.get_resp_header(conn, "content-type") end test "pass conn downstream if the cache not found" do