mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 15:28:37 +08:00
FIX: rate limit user posts export
This commit is contained in:
@ -14,6 +14,13 @@ describe ExportCsvController do
|
||||
response.should be_success
|
||||
end
|
||||
|
||||
it "should not enqueue export job if rate limit is reached" do
|
||||
Jobs::ExportCsvFile.any_instance.expects(:execute).never
|
||||
UserExport.create(export_type: "user", user_id: @user.id)
|
||||
xhr :post, :export_entity, entity: "user_archive", entity_type: "user"
|
||||
response.should_not be_success
|
||||
end
|
||||
|
||||
it "returns 404 when normal user tries to export admin entity" do
|
||||
xhr :post, :export_entity, entity: "staff_action", entity_type: "admin"
|
||||
response.should_not be_success
|
||||
@ -55,6 +62,13 @@ describe ExportCsvController do
|
||||
xhr :post, :export_entity, entity: "staff_action", entity_type: "admin"
|
||||
response.should be_success
|
||||
end
|
||||
|
||||
it "should not rate limit export for staff" do
|
||||
Jobs.expects(:enqueue).with(:export_csv_file, has_entries(entity: "staff_action", user_id: @admin.id))
|
||||
UserExport.create(export_type: "admin", user_id: @admin.id)
|
||||
xhr :post, :export_entity, entity: "staff_action", entity_type: "admin"
|
||||
response.should be_success
|
||||
end
|
||||
end
|
||||
|
||||
describe ".download" do
|
||||
|
Reference in New Issue
Block a user