-
Notifications
You must be signed in to change notification settings - Fork 368
Expand file tree
/
Copy pathadmin_actions_spec.rb
More file actions
36 lines (30 loc) · 1.04 KB
/
admin_actions_spec.rb
File metadata and controls
36 lines (30 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
require 'spec_helper'
require 'request_spec_shared_examples'
RSpec.describe 'admin actions' do
let(:space) { VCAP::CloudController::Space.make }
let(:org) { space.organization }
let(:user) { VCAP::CloudController::User.make }
let(:admin_header) { admin_headers_for(user) }
describe 'POST /v3/admin/actions/clear_buildpack_cache' do
let(:api_call) { ->(user_headers) { post '/v3/admin/actions/clear_buildpack_cache', {}, user_headers } }
let(:expected_codes_and_responses) do
h = Hash.new(
{ code: 403 }.freeze
)
h['admin'] = {
code: 202
}
h
end
it_behaves_like 'permissions for single object endpoint', ALL_PERMISSIONS do
let(:after_request_check) do
lambda do
job_guid = last_response.headers['Location'].gsub("#{link_prefix}/v3/jobs/", '')
get "/v3/jobs/#{job_guid}", {}, admin_headers
expect(last_response).to have_status_code(200)
execute_all_jobs(expected_successes: 1, expected_failures: 0)
end
end
end
end
end