Commit 54029fe2 authored by rinpatch's avatar rinpatch

tests: remove a useless sleep in rate limiter tests

It was used to check that authenticated and unauthenticated users have
different limits. Instead of sleeping a super low limit for
unauthenticated users was set, preventing them from doing 5 requests in
the first place.
parent 137a3d22
......@@ -99,7 +99,7 @@ test "it creates a participation for a conversation and a user" do
assert participation.user_id ==
assert participation.conversation_id ==
# Needed because updated_at is accurate down to a second
......@@ -145,9 +145,9 @@ test "are restricted based on remote IP" do
test "can have limits seperate from unauthenticated connections" do
limiter_name = :test_authenticated
scale = 1000
scale = 50
limit = 5
Pleroma.Config.put([:rate_limit, limiter_name], [{1, 10}, {scale, limit}])
Pleroma.Config.put([:rate_limit, limiter_name], [{1000, 1}, {scale, limit}])
opts = RateLimiter.init(name: limiter_name)
......@@ -164,16 +164,6 @@ test "can have limits seperate from unauthenticated connections" do
assert %{"error" => "Throttled"} = Phoenix.ConnTest.json_response(conn, :too_many_requests)
assert conn.halted
conn = conn(:get, "/") |> assign(:user, user)
conn =, opts)
assert {1, 4} = RateLimiter.inspect_bucket(conn, limiter_name, opts)
refute conn.status == Plug.Conn.Status.code(:too_many_requests)
refute conn.resp_body
refute conn.halted
test "diffrerent users are counted independently" do
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment