X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/973d62a25ebf22bf80663a8b6996f0dbe7d5289f..349f5e0655f5026db54e4795e48a688eb2b7a654:/test/controllers/api/changeset_comments_controller_test.rb?ds=sidebyside diff --git a/test/controllers/api/changeset_comments_controller_test.rb b/test/controllers/api/changeset_comments_controller_test.rb index ca7fc3407..21f30714c 100644 --- a/test/controllers/api/changeset_comments_controller_test.rb +++ b/test/controllers/api/changeset_comments_controller_test.rb @@ -158,7 +158,7 @@ module Api def test_create_comment_experienced_user_rate_limit changeset = create(:changeset, :closed) user = create(:user) - create_list(:changeset_comment, 200, :author_id => user.id, :created_at => Time.now.utc - 1.day) + create_list(:changeset_comment, Settings.comments_to_max_changeset_comments, :author_id => user.id, :created_at => Time.now.utc - 1.day) auth_header = bearer_authorization_header user @@ -303,11 +303,11 @@ module Api # But writing oauth tests is hard, and so it's easier to put in a controller test.) def test_api_write_and_terms_agreed_via_token user = create(:user, :terms_agreed => nil) - token = create(:oauth_access_token, :resource_owner_id => user.id, :scopes => %w[write_api]) + auth_header = bearer_authorization_header(user, :scopes => %w[write_api]) changeset = create(:changeset, :closed) assert_difference "ChangesetComment.count", 0 do - post changeset_comment_path(changeset), :params => { :text => "This is a comment" }, :headers => bearer_authorization_header(token.token) + post changeset_comment_path(changeset), :params => { :text => "This is a comment" }, :headers => auth_header end assert_response :forbidden @@ -316,7 +316,7 @@ module Api user.save! assert_difference "ChangesetComment.count", 1 do - post changeset_comment_path(changeset), :params => { :text => "This is a comment" }, :headers => bearer_authorization_header(token.token) + post changeset_comment_path(changeset), :params => { :text => "This is a comment" }, :headers => auth_header end assert_response :success end