diff options
author | Alexis Reigel <alexis.reigel.ext@siemens.com> | 2018-06-11 13:37:47 +0200 |
---|---|---|
committer | Alexis Reigel <alexis.reigel.ext@siemens.com> | 2018-09-15 21:39:26 +0200 |
commit | 4b6619cfd3ca127d728d7277cac3da8ed54b99b0 (patch) | |
tree | b590ee77d626f085443ffd9ea3b08c03078e5448 /spec/requests | |
parent | 65caacc600bc0a507a313e8be45021512260906e (diff) | |
download | gitlab-ce-4b6619cfd3ca127d728d7277cac3da8ed54b99b0.tar.gz |
add type param to runners api
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/runners_spec.rb | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/spec/requests/api/runners_spec.rb b/spec/requests/api/runners_spec.rb index c2fed09a5d2..3939500d7ca 100644 --- a/spec/requests/api/runners_spec.rb +++ b/spec/requests/api/runners_spec.rb @@ -55,6 +55,21 @@ describe API::Runners do get api('/runners?scope=unknown', user) expect(response).to have_gitlab_http_status(400) end + + it 'filters runners by type' do + get api('/runners?type=project_type', user) + + expect(json_response).to match_array [ + a_hash_including('description' => 'Project runner'), + a_hash_including('description' => 'Two projects runner') + ] + end + + it 'does not filter by invalid type' do + get api('/runners?type=bogus', user) + + expect(response).to have_gitlab_http_status(400) + end end context 'unauthorized user' do @@ -115,6 +130,21 @@ describe API::Runners do get api('/runners/all?scope=unknown', admin) expect(response).to have_gitlab_http_status(400) end + + it 'filters runners by type' do + get api('/runners/all?type=project_type', admin) + + expect(json_response).to match_array [ + a_hash_including('description' => 'Project runner'), + a_hash_including('description' => 'Two projects runner') + ] + end + + it 'does not filter by invalid type' do + get api('/runners/all?type=bogus', admin) + + expect(response).to have_gitlab_http_status(400) + end end context 'unauthorized user' do @@ -603,6 +633,21 @@ describe API::Runners do get api("/projects/#{project.id}/runners?scope=unknown", user) expect(response).to have_gitlab_http_status(400) end + + it 'filters runners by type' do + get api("/projects/#{project.id}/runners?type=project_type", user) + + expect(json_response).to match_array [ + a_hash_including('description' => 'Project runner'), + a_hash_including('description' => 'Two projects runner') + ] + end + + it 'does not filter by invalid type' do + get api("/projects/#{project.id}/runners?type=bogus", user) + + expect(response).to have_gitlab_http_status(400) + end end context 'authorized user without maintainer privileges' do |