mirror of
https://github.com/discourse/discourse.git
synced 2024-12-01 13:09:33 -06:00
DEV: Fix uploads controller flaky presigned put spec (#13985)
Was missing RateLimiter.clear_all!, leading to 403 errors
This commit is contained in:
parent
93af139a76
commit
6774c600a4
@ -706,12 +706,9 @@ describe UploadsController do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "#generate_presigned_put" do
|
describe "#generate_presigned_put" do
|
||||||
before do
|
|
||||||
sign_in(user)
|
|
||||||
end
|
|
||||||
|
|
||||||
context "when the store is external" do
|
context "when the store is external" do
|
||||||
before do
|
before do
|
||||||
|
sign_in(user)
|
||||||
SiteSetting.enable_direct_s3_uploads = true
|
SiteSetting.enable_direct_s3_uploads = true
|
||||||
setup_s3
|
setup_s3
|
||||||
end
|
end
|
||||||
@ -761,6 +758,8 @@ describe UploadsController do
|
|||||||
|
|
||||||
it "rate limits" do
|
it "rate limits" do
|
||||||
RateLimiter.enable
|
RateLimiter.enable
|
||||||
|
RateLimiter.clear_all!
|
||||||
|
|
||||||
stub_const(UploadsController, "PRESIGNED_PUT_RATE_LIMIT_PER_MINUTE", 1) do
|
stub_const(UploadsController, "PRESIGNED_PUT_RATE_LIMIT_PER_MINUTE", 1) do
|
||||||
post "/uploads/generate-presigned-put.json", params: { file_name: "test.png", type: "card_background" }
|
post "/uploads/generate-presigned-put.json", params: { file_name: "test.png", type: "card_background" }
|
||||||
post "/uploads/generate-presigned-put.json", params: { file_name: "test.png", type: "card_background" }
|
post "/uploads/generate-presigned-put.json", params: { file_name: "test.png", type: "card_background" }
|
||||||
@ -770,6 +769,10 @@ describe UploadsController do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "when the store is not external" do
|
context "when the store is not external" do
|
||||||
|
before do
|
||||||
|
sign_in(user)
|
||||||
|
end
|
||||||
|
|
||||||
it "returns 404" do
|
it "returns 404" do
|
||||||
post "/uploads/generate-presigned-put.json", params: { file_name: "test.png", type: "card_background" }
|
post "/uploads/generate-presigned-put.json", params: { file_name: "test.png", type: "card_background" }
|
||||||
expect(response.status).to eq(404)
|
expect(response.status).to eq(404)
|
||||||
|
Loading…
Reference in New Issue
Block a user