summaryrefslogtreecommitdiff
path: root/spec/requests
diff options
context:
space:
mode:
authorJB Vasseur <jvasseur@gmail.com>2018-10-11 19:54:15 +0900
committerJB Vasseur <jvasseur@gmail.com>2018-10-11 19:54:15 +0900
commit6dd4ae0d87fd9a30ab9ce36b5127be36929f5692 (patch)
tree284c71c5f9f6b2db8bf10160bc20de98c96bdcd8 /spec/requests
parent3421f1d124ecf34c620d75488c22fa3fab602721 (diff)
downloadgitlab-ce-6dd4ae0d87fd9a30ab9ce36b5127be36929f5692.tar.gz
Support GET /applications and DELETE /applications/:id endpoints #52559
Diffstat (limited to 'spec/requests')
-rw-r--r--spec/requests/api/applications_spec.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/requests/api/applications_spec.rb b/spec/requests/api/applications_spec.rb
index f56bc932f40..02dfbfa8fd7 100644
--- a/spec/requests/api/applications_spec.rb
+++ b/spec/requests/api/applications_spec.rb
@@ -5,6 +5,7 @@ describe API::Applications, :api do
let(:admin_user) { create(:user, admin: true) }
let(:user) { create(:user, admin: false) }
+ let(:application) { create(:application, name: 'application_name', redirect_uri: 'http://application.url', scopes: '') }
describe 'POST /applications' do
context 'authenticated and authorized user' do
@@ -83,4 +84,41 @@ describe API::Applications, :api do
end
end
end
+
+ describe 'GET /applications' do
+ context 'authenticated and authorized user' do
+ it 'can list application' do
+ get api('/applications')
+
+ expect(response).to have_gitlab_http_status(200)
+ expect(json_response).to be_a(Array)
+ end
+ end
+
+ context 'non-authenticated user' do
+ it 'cannot list application' do
+ get api('/applications')
+
+ expect(response).to have_http_status 401
+ end
+ end
+ end
+
+ describe 'DELETE /applications/:id' do
+ context 'authenticated and authorized user' do
+ it 'can delete an application' do
+ delete api("/applications/#{application.id}")
+
+ expect(response).to have_gitlab_http_status(204)
+ end
+ end
+
+ context 'non-authenticated user' do
+ it 'cannot delete an application' do
+ delete api("/applications/#{application.id}")
+
+ expect(response).to have_http_status 401
+ end
+ end
+ end
end