Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2018-09-20 14:02:59 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2018-09-20 14:02:59 +0300
commit98a319a482f0dcae8e99d3d3d5f416ef79964c64 (patch)
treeae0c4d647ff6207a40805b076bd17e193984af75 /spec/controllers/oauth
parent8c2192943a5efc4d0a28c67b04bf9b979def66a1 (diff)
Always allow user to revoke an authorized application
Even if User OAuth applications setting is disabled in admin settings. Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'spec/controllers/oauth')
-rw-r--r--spec/controllers/oauth/applications_controller_spec.rb32
1 files changed, 31 insertions, 1 deletions
diff --git a/spec/controllers/oauth/applications_controller_spec.rb b/spec/controllers/oauth/applications_controller_spec.rb
index 1195f44f37d..9545815cb04 100644
--- a/spec/controllers/oauth/applications_controller_spec.rb
+++ b/spec/controllers/oauth/applications_controller_spec.rb
@@ -16,13 +16,43 @@ describe Oauth::ApplicationsController do
end
it 'redirects back to profile page if OAuth applications are disabled' do
- allow(Gitlab::CurrentSettings.current_application_settings).to receive(:user_oauth_applications?).and_return(false)
+ disable_user_oauth
get :index
+ expect(response).to have_gitlab_http_status(200)
+ end
+ end
+
+ describe 'POST #create' do
+ it 'creates an application' do
+ post :create, oauth_params
+
+ expect(response).to have_gitlab_http_status(302)
+ expect(response).to redirect_to(oauth_application_path(Doorkeeper::Application.last))
+ end
+
+ it 'redirects back to profile page if OAuth applications are disabled' do
+ disable_user_oauth
+
+ post :create, oauth_params
+
expect(response).to have_gitlab_http_status(302)
expect(response).to redirect_to(profile_path)
end
end
end
+
+ def disable_user_oauth
+ allow(Gitlab::CurrentSettings.current_application_settings).to receive(:user_oauth_applications?).and_return(false)
+ end
+
+ def oauth_params
+ {
+ doorkeeper_application: {
+ name: 'foo',
+ redirect_uri: 'http://example.org'
+ }
+ }
+ end
end