X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/f884be441dee0c9412c2f776816cdee225ecb394..64859303f6ce0aaebee599ad5d62d799845fb6c9:/test/controllers/oauth2_authorized_applications_controller_test.rb?ds=sidebyside diff --git a/test/controllers/oauth2_authorized_applications_controller_test.rb b/test/controllers/oauth2_authorized_applications_controller_test.rb index c01f7d6f3..250634781 100644 --- a/test/controllers/oauth2_authorized_applications_controller_test.rb +++ b/test/controllers/oauth2_authorized_applications_controller_test.rb @@ -17,15 +17,14 @@ class Oauth2AuthorizedApplicationsControllerTest < ActionDispatch::IntegrationTe def test_index user = create(:user) application1 = create(:oauth_application) - create(:oauth_access_grant, :resource_owner_id => user.id, :application => application1) - create(:oauth_access_token, :resource_owner_id => user.id, :application => application1) + create(:oauth_access_grant, :user => user, :application => application1) + create(:oauth_access_token, :user => user, :application => application1) application2 = create(:oauth_application) - create(:oauth_access_grant, :resource_owner_id => user.id, :application => application2) - create(:oauth_access_token, :resource_owner_id => user.id, :application => application2) + create(:oauth_access_grant, :user => user, :application => application2) + create(:oauth_access_token, :user => user, :application => application2) create(:oauth_application) get oauth_authorized_applications_path - assert_response :redirect assert_redirected_to login_path(:referer => oauth_authorized_applications_path) session_for(user) @@ -39,13 +38,12 @@ class Oauth2AuthorizedApplicationsControllerTest < ActionDispatch::IntegrationTe def test_index_scopes user = create(:user) application1 = create(:oauth_application, :scopes => %w[read_prefs write_prefs write_diary read_gpx write_gpx]) - create(:oauth_access_grant, :resource_owner_id => user.id, :application => application1, :scopes => %w[read_prefs write_prefs]) - create(:oauth_access_token, :resource_owner_id => user.id, :application => application1, :scopes => %w[read_prefs write_prefs]) - create(:oauth_access_grant, :resource_owner_id => user.id, :application => application1, :scopes => %w[read_prefs write_diary]) - create(:oauth_access_token, :resource_owner_id => user.id, :application => application1, :scopes => %w[read_prefs write_diary]) + create(:oauth_access_grant, :user => user, :application => application1, :scopes => %w[read_prefs write_prefs]) + create(:oauth_access_token, :user => user, :application => application1, :scopes => %w[read_prefs write_prefs]) + create(:oauth_access_grant, :user => user, :application => application1, :scopes => %w[read_prefs write_diary]) + create(:oauth_access_token, :user => user, :application => application1, :scopes => %w[read_prefs write_diary]) get oauth_authorized_applications_path - assert_response :redirect assert_redirected_to login_path(:referer => oauth_authorized_applications_path) session_for(user) @@ -58,18 +56,18 @@ class Oauth2AuthorizedApplicationsControllerTest < ActionDispatch::IntegrationTe assert_select "li", :count => 3 assert_select "li", :text => "Read user preferences" assert_select "li", :text => "Modify user preferences" - assert_select "li", :text => "Create diary entries, comments and make friends" + assert_select "li", :text => "Create diary entries and comments" end end def test_destroy user = create(:user) application1 = create(:oauth_application) - create(:oauth_access_grant, :resource_owner_id => user.id, :application => application1) - create(:oauth_access_token, :resource_owner_id => user.id, :application => application1) + create(:oauth_access_grant, :user => user, :application => application1) + create(:oauth_access_token, :user => user, :application => application1) application2 = create(:oauth_application) - create(:oauth_access_grant, :resource_owner_id => user.id, :application => application2) - create(:oauth_access_token, :resource_owner_id => user.id, :application => application2) + create(:oauth_access_grant, :user => user, :application => application2) + create(:oauth_access_token, :user => user, :application => application2) create(:oauth_application) delete oauth_authorized_application_path(:id => application1.id) @@ -78,7 +76,6 @@ class Oauth2AuthorizedApplicationsControllerTest < ActionDispatch::IntegrationTe session_for(user) delete oauth_authorized_application_path(:id => application1.id) - assert_response :redirect assert_redirected_to oauth_authorized_applications_path get oauth_authorized_applications_path