X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/9e4a240975ff9f4b7501059f62552f86e2159819..cee9818dfc9ac3f6eae01cdb51df9093ae5d1322:/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 d3b171588..f479b24b3 100644 --- a/test/controllers/api/changeset_comments_controller_test.rb +++ b/test/controllers/api/changeset_comments_controller_test.rb @@ -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(:access_token, :user => user, :allow_write_api => true) + token = create(:oauth_access_token, :resource_owner_id => user.id, :scopes => %w[write_api]) changeset = create(:changeset, :closed) assert_difference "ChangesetComment.count", 0 do - signed_post changeset_comment_path(changeset), :params => { :text => "This is a comment" }, :oauth => { :token => token } + post changeset_comment_path(changeset), :params => { :text => "This is a comment" }, :headers => bearer_authorization_header(token.token) end assert_response :forbidden @@ -316,7 +316,7 @@ module Api user.save! assert_difference "ChangesetComment.count", 1 do - signed_post changeset_comment_path(changeset), :params => { :text => "This is a comment" }, :oauth => { :token => token } + post changeset_comment_path(changeset), :params => { :text => "This is a comment" }, :headers => bearer_authorization_header(token.token) end assert_response :success end