X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/5966acc207874f3196a43700cb9306411c77fe47..5e26b33235bab027f25f98afb8db8980f3603b0b:/test/controllers/oauth2_applications_controller_test.rb diff --git a/test/controllers/oauth2_applications_controller_test.rb b/test/controllers/oauth2_applications_controller_test.rb index 149b6ee35..1333fa000 100644 --- a/test/controllers/oauth2_applications_controller_test.rb +++ b/test/controllers/oauth2_applications_controller_test.rb @@ -43,7 +43,6 @@ class Oauth2ApplicationsControllerTest < ActionDispatch::IntegrationTest create_list(:oauth_application, 2, :owner => user) get oauth_applications_path - assert_response :redirect assert_redirected_to login_path(:referer => oauth_applications_path) session_for(user) @@ -51,14 +50,23 @@ class Oauth2ApplicationsControllerTest < ActionDispatch::IntegrationTest get oauth_applications_path assert_response :success assert_template "oauth2_applications/index" - assert_select "tr", 2 + assert_select "tbody tr", 2 + end + + def test_index_with_moderator_app + user = create(:user) + create(:oauth_application, :owner => user, :scopes => "write_redactions") + + session_for(user) + + get oauth_applications_path + assert_response :success end def test_new user = create(:user) get new_oauth_application_path - assert_response :redirect assert_redirected_to login_path(:referer => new_oauth_application_path) session_for(user) @@ -111,7 +119,6 @@ class Oauth2ApplicationsControllerTest < ActionDispatch::IntegrationTest :scopes => ["read_prefs"] }) end - assert_response :redirect assert_redirected_to oauth_application_path(:id => Doorkeeper::Application.find_by(:name => "Test Application").id) end @@ -137,7 +144,6 @@ class Oauth2ApplicationsControllerTest < ActionDispatch::IntegrationTest :scopes => ["read_email"] }) end - assert_response :redirect assert_redirected_to oauth_application_path(:id => Doorkeeper::Application.find_by(:name => "Test Application").id) end @@ -147,7 +153,6 @@ class Oauth2ApplicationsControllerTest < ActionDispatch::IntegrationTest other_client = create(:oauth_application) get oauth_application_path(:id => client) - assert_response :redirect assert_redirected_to login_path(:referer => oauth_application_path(:id => client.id)) session_for(user) @@ -167,7 +172,6 @@ class Oauth2ApplicationsControllerTest < ActionDispatch::IntegrationTest other_client = create(:oauth_application) get edit_oauth_application_path(:id => client) - assert_response :redirect assert_redirected_to login_path(:referer => edit_oauth_application_path(:id => client.id)) session_for(user) @@ -216,7 +220,6 @@ class Oauth2ApplicationsControllerTest < ActionDispatch::IntegrationTest :name => "New Name", :redirect_uri => "https://new.example.com/url" }) - assert_response :redirect assert_redirected_to oauth_application_path(:id => client.id) end @@ -241,7 +244,6 @@ class Oauth2ApplicationsControllerTest < ActionDispatch::IntegrationTest assert_difference "Doorkeeper::Application.count", -1 do delete oauth_application_path(:id => client) end - assert_response :redirect assert_redirected_to oauth_applications_path end end