Enforce rate limit for API calls which make changes

This commit is contained in:
Tom Hughes 2023-10-29 16:11:23 +00:00
parent 2f11b77309
commit ba503e02d2
6 changed files with 22 additions and 1 deletions

View file

@ -2183,7 +2183,11 @@ module Api
# check that a changeset can contain a certain max number of changes.
## FIXME should be changed to an integration test due to the with_controller
def test_changeset_limits
auth_header = basic_authorization_header create(:user).email, "test"
user = create(:user)
auth_header = basic_authorization_header user.email, "test"
# create an old changeset to ensure we have the maximum rate limit
create(:changeset, :user => user, :created_at => Time.now.utc - 28.days)
# open a new changeset
xml = "<osm><changeset/></osm>"