X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/8979c597e34333f559d2dad57ccc42b8887d5d3d..2ee404ca0785c857ea6282992483468f5341b9f0:/test/controllers/oauth_clients_controller_test.rb diff --git a/test/controllers/oauth_clients_controller_test.rb b/test/controllers/oauth_clients_controller_test.rb index b610cb0b7..e448e0954 100644 --- a/test/controllers/oauth_clients_controller_test.rb +++ b/test/controllers/oauth_clients_controller_test.rb @@ -40,7 +40,6 @@ class OauthClientsControllerTest < ActionDispatch::IntegrationTest create_list(:access_token, 2, :user => user) get oauth_clients_path(:display_name => user.display_name) - assert_response :redirect assert_redirected_to login_path(:referer => oauth_clients_path(:display_name => user.display_name)) session_for(user) @@ -48,14 +47,13 @@ class OauthClientsControllerTest < ActionDispatch::IntegrationTest get oauth_clients_path(:display_name => user.display_name) assert_response :success assert_template "index" - assert_select "div.client_application", 2 + assert_select "li.client_application", 2 end def test_new user = create(:user) get new_oauth_client_path(:display_name => user.display_name) - assert_response :redirect assert_redirected_to login_path(:referer => new_oauth_client_path(:display_name => user.display_name)) session_for(user) @@ -74,6 +72,20 @@ class OauthClientsControllerTest < ActionDispatch::IntegrationTest end end + def test_new_disabled + user = create(:user) + + with_settings(:oauth_10_registration => false) do + get new_oauth_client_path(:display_name => user.display_name) + assert_redirected_to login_path(:referer => new_oauth_client_path(:display_name => user.display_name)) + + session_for(user) + + get new_oauth_client_path(:display_name => user.display_name) + assert_redirected_to oauth_clients_path(:display_name => user.display_name) + end + end + def test_create user = create(:user) @@ -96,7 +108,6 @@ class OauthClientsControllerTest < ActionDispatch::IntegrationTest :client_application => { :name => "Test Application", :url => "http://test.example.com/" }) end - assert_response :redirect assert_redirected_to oauth_client_path(:id => ClientApplication.find_by(:name => "Test Application").id) end @@ -106,7 +117,6 @@ class OauthClientsControllerTest < ActionDispatch::IntegrationTest other_client = create(:client_application) get oauth_client_path(:display_name => user.display_name, :id => client) - assert_response :redirect assert_redirected_to login_path(:referer => oauth_client_path(:display_name => user.display_name, :id => client.id)) session_for(user) @@ -126,7 +136,6 @@ class OauthClientsControllerTest < ActionDispatch::IntegrationTest other_client = create(:client_application) get edit_oauth_client_path(:display_name => user.display_name, :id => client) - assert_response :redirect assert_redirected_to login_path(:referer => edit_oauth_client_path(:display_name => user.display_name, :id => client.id)) session_for(user) @@ -170,7 +179,6 @@ class OauthClientsControllerTest < ActionDispatch::IntegrationTest put oauth_client_path(:display_name => user.display_name, :id => client, :client_application => { :name => "New Name", :url => "http://new.example.com/url" }) - assert_response :redirect assert_redirected_to oauth_client_path(:id => client.id) end @@ -195,7 +203,6 @@ class OauthClientsControllerTest < ActionDispatch::IntegrationTest assert_difference "ClientApplication.count", -1 do delete oauth_client_path(:display_name => user.display_name, :id => client) end - assert_response :redirect assert_redirected_to oauth_clients_path(:display_name => user.display_name) end end