X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/b70da7b8ea15ab48bb2f34155567cea6dffc8fc9..b6f0c40a6084f245602393820400193373adf2aa:/test/controllers/api/permissions_controller_test.rb diff --git a/test/controllers/api/permissions_controller_test.rb b/test/controllers/api/permissions_controller_test.rb index b927ca703..3101abee2 100644 --- a/test/controllers/api/permissions_controller_test.rb +++ b/test/controllers/api/permissions_controller_test.rb @@ -31,7 +31,7 @@ module Api end end - def test_permissions_oauth + def test_permissions_oauth1 token = create(:access_token, :allow_read_prefs => true, :allow_write_api => true, @@ -45,5 +45,20 @@ module Api assert_select "permission[name='allow_read_gpx']", :count => 0 end end + + def test_permissions_oauth2 + user = create(:user) + token = create(:oauth_access_token, + :resource_owner_id => user.id, + :scopes => %w[read_prefs write_api]) + get permissions_path, :headers => bearer_authorization_header(token.token) + assert_response :success + assert_select "osm > permissions", :count => 1 do + assert_select "permission", :count => 2 + assert_select "permission[name='allow_read_prefs']", :count => 1 + assert_select "permission[name='allow_write_api']", :count => 1 + assert_select "permission[name='allow_read_gpx']", :count => 0 + end + end end end