]> git.openstreetmap.org Git - rails.git/blobdiff - test/controllers/oauth2_authorizations_controller_test.rb
Merge remote-tracking branch 'upstream/pull/5394'
[rails.git] / test / controllers / oauth2_authorizations_controller_test.rb
index 19bc7980828ea5f5cb785686b83cda3d89721574..854f7cde5c717ef4c4e91ff19ee4633ed0557476 100644 (file)
@@ -29,7 +29,6 @@ class Oauth2AuthorizationsControllerTest < ActionDispatch::IntegrationTest
                                  :redirect_uri => application.redirect_uri,
                                  :response_type => "code",
                                  :scope => "write_api")
                                  :redirect_uri => application.redirect_uri,
                                  :response_type => "code",
                                  :scope => "write_api")
-    assert_response :redirect
     assert_redirected_to login_path(:referer => oauth_authorization_path(:client_id => application.uid,
                                                                          :redirect_uri => application.redirect_uri,
                                                                          :response_type => "code",
     assert_redirected_to login_path(:referer => oauth_authorization_path(:client_id => application.uid,
                                                                          :redirect_uri => application.redirect_uri,
                                                                          :response_type => "code",
@@ -52,7 +51,6 @@ class Oauth2AuthorizationsControllerTest < ActionDispatch::IntegrationTest
                                  :redirect_uri => application.redirect_uri,
                                  :response_type => "code",
                                  :scope => "write_api")
                                  :redirect_uri => application.redirect_uri,
                                  :response_type => "code",
                                  :scope => "write_api")
-    assert_response :redirect
     assert_redirected_to login_path(:referer => oauth_authorization_path(:client_id => application.uid,
                                                                          :redirect_uri => application.redirect_uri,
                                                                          :response_type => "code",
     assert_redirected_to login_path(:referer => oauth_authorization_path(:client_id => application.uid,
                                                                          :redirect_uri => application.redirect_uri,
                                                                          :response_type => "code",
@@ -77,7 +75,7 @@ class Oauth2AuthorizationsControllerTest < ActionDispatch::IntegrationTest
                                  :redirect_uri => "https://bad.example.com/",
                                  :response_type => "code",
                                  :scope => "write_api")
                                  :redirect_uri => "https://bad.example.com/",
                                  :response_type => "code",
                                  :scope => "write_api")
-    assert_response :success
+    assert_response :bad_request
     assert_template "oauth2_authorizations/error"
     assert_select "p", "The requested redirect uri is malformed or doesn't match client redirect URI."
   end
     assert_template "oauth2_authorizations/error"
     assert_select "p", "The requested redirect uri is malformed or doesn't match client redirect URI."
   end
@@ -91,7 +89,7 @@ class Oauth2AuthorizationsControllerTest < ActionDispatch::IntegrationTest
                                  :redirect_uri => application.redirect_uri,
                                  :response_type => "code",
                                  :scope => "bad_scope")
                                  :redirect_uri => application.redirect_uri,
                                  :response_type => "code",
                                  :scope => "bad_scope")
-    assert_response :success
+    assert_response :bad_request
     assert_template "oauth2_authorizations/error"
     assert_select "p", "The requested scope is invalid, unknown, or malformed."
 
     assert_template "oauth2_authorizations/error"
     assert_select "p", "The requested scope is invalid, unknown, or malformed."
 
@@ -99,7 +97,7 @@ class Oauth2AuthorizationsControllerTest < ActionDispatch::IntegrationTest
                                  :redirect_uri => application.redirect_uri,
                                  :response_type => "code",
                                  :scope => "write_prefs")
                                  :redirect_uri => application.redirect_uri,
                                  :response_type => "code",
                                  :scope => "write_prefs")
-    assert_response :success
+    assert_response :bad_request
     assert_template "oauth2_authorizations/error"
     assert_select "p", "The requested scope is invalid, unknown, or malformed."
   end
     assert_template "oauth2_authorizations/error"
     assert_select "p", "The requested scope is invalid, unknown, or malformed."
   end
@@ -119,7 +117,6 @@ class Oauth2AuthorizationsControllerTest < ActionDispatch::IntegrationTest
                                   :redirect_uri => application.redirect_uri,
                                   :response_type => "code",
                                   :scope => "write_api")
                                   :redirect_uri => application.redirect_uri,
                                   :response_type => "code",
                                   :scope => "write_api")
-    assert_response :redirect
     assert_redirected_to(/^#{Regexp.escape(application.redirect_uri)}\?code=/)
   end
 
     assert_redirected_to(/^#{Regexp.escape(application.redirect_uri)}\?code=/)
   end
 
@@ -160,7 +157,6 @@ class Oauth2AuthorizationsControllerTest < ActionDispatch::IntegrationTest
                                     :redirect_uri => application.redirect_uri,
                                     :response_type => "code",
                                     :scope => "write_api")
                                     :redirect_uri => application.redirect_uri,
                                     :response_type => "code",
                                     :scope => "write_api")
-    assert_response :redirect
     assert_redirected_to(/^#{Regexp.escape(application.redirect_uri)}\?error=access_denied/)
   end
 
     assert_redirected_to(/^#{Regexp.escape(application.redirect_uri)}\?error=access_denied/)
   end