aboutsummaryrefslogtreecommitdiff
path: root/test/web/mastodon_api/mastodon_api_controller_test.exs
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2018-05-05 11:15:57 +0200
committerlain <lain@soykaf.club>2018-05-05 11:15:57 +0200
commitc464355d1ac7f9558aa50f7038035b9a47614822 (patch)
treed6a0ba34a419b8c11756fb5838fec811677210d6 /test/web/mastodon_api/mastodon_api_controller_test.exs
parent762f6edc29a7a48e3a663e9bedec58e0036ff363 (diff)
downloadpleroma-c464355d1ac7f9558aa50f7038035b9a47614822.tar.gz
Idempotency: Use special cache, keep for 6 hours.
Diffstat (limited to 'test/web/mastodon_api/mastodon_api_controller_test.exs')
-rw-r--r--test/web/mastodon_api/mastodon_api_controller_test.exs19
1 files changed, 16 insertions, 3 deletions
diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs
index 69a0299ac..883ebc61e 100644
--- a/test/web/mastodon_api/mastodon_api_controller_test.exs
+++ b/test/web/mastodon_api/mastodon_api_controller_test.exs
@@ -75,9 +75,9 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
"sensitive" => "false"
})
- {:ok, ttl} = Cachex.ttl(:user_cache, "idem:#{idempotency_key}")
- # 5 Minutes
- assert ttl > :timer.seconds(5 * 60 - 1)
+ {:ok, ttl} = Cachex.ttl(:idempotency_cache, idempotency_key)
+ # Six hours
+ assert ttl > :timer.seconds(6 * 60 * 60 - 1)
assert %{"content" => "cofe", "id" => id, "spoiler_text" => "2hu", "sensitive" => false} =
json_response(conn_one, 200)
@@ -97,6 +97,19 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
assert %{"id" => second_id} = json_response(conn_two, 200)
assert id == second_id
+
+ conn_three =
+ conn
+ |> assign(:user, user)
+ |> post("/api/v1/statuses", %{
+ "status" => "cofe",
+ "spoiler_text" => "2hu",
+ "sensitive" => "false"
+ })
+
+ assert %{"id" => third_id} = json_response(conn_three, 200)
+
+ refute id == third_id
end
test "posting a sensitive status", %{conn: conn} do