Skip to content

Commit 2dfd8f0

Browse files
committed
Remove obsolete authentication tests
1 parent 83d860e commit 2dfd8f0

File tree

2 files changed

+0
-88
lines changed

2 files changed

+0
-88
lines changed

app/controllers/internal/staging_completion_controller.rb

-13
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,6 @@ def self.dependencies
1111

1212
allow_unauthenticated_access
1313

14-
def initialize(*)
15-
super
16-
auth = Rack::Auth::Basic::Request.new(env)
17-
18-
if Config.kubernetes_api_configured?
19-
return
20-
end
21-
22-
unless auth.provided? && auth.basic? && auth.credentials == InternalApi.credentials
23-
raise CloudController::Errors::NotAuthenticated
24-
end
25-
end
26-
2714
def inject_dependencies(dependencies)
2815
super
2916
@stagers = dependencies.fetch(:stagers)

spec/unit/controllers/internal/staging_completion_controller_spec.rb

-75
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,6 @@ module VCAP::CloudController
6161
let(:droplet) { DropletModel.make(package_guid: package.guid, app_guid: staged_app.guid, state: DropletModel::STAGING_STATE) }
6262
let(:staging_guid) { droplet.guid }
6363

64-
before do
65-
@internal_user = 'internal_user'
66-
@internal_password = 'internal_password'
67-
authorize @internal_user, @internal_password
68-
end
69-
7064
context 'when it is a docker app' do
7165
let(:droplet) { DropletModel.make(:docker, package_guid: package.guid, app_guid: staged_app.guid, state: DropletModel::STAGING_STATE) }
7266

@@ -197,46 +191,6 @@ module VCAP::CloudController
197191
end
198192
end
199193

200-
describe 'authentication' do
201-
context 'when running in Kubernetes' do
202-
before do
203-
TestConfig.override(kubernetes: { host_url: 'example.com' })
204-
end
205-
206-
context 'when missing authentication' do
207-
it 'succeeds' do
208-
header('Authorization', nil)
209-
post url, MultiJson.dump(staging_response)
210-
expect(last_response.status).to eq(200)
211-
end
212-
end
213-
end
214-
215-
context 'when missing authentication' do
216-
it 'fails with authentication required' do
217-
header('Authorization', nil)
218-
post url, staging_response
219-
expect(last_response.status).to eq(401)
220-
end
221-
end
222-
223-
context 'when using invalid credentials' do
224-
it 'fails with authenticatiom required' do
225-
authorize 'bar', 'foo'
226-
post url, staging_response
227-
expect(last_response.status).to eq(401)
228-
end
229-
end
230-
231-
context 'when using valid credentials' do
232-
it 'succeeds' do
233-
allow_any_instance_of(Diego::Stager).to receive(:staging_complete)
234-
post url, MultiJson.dump(staging_response)
235-
expect(last_response.status).to eq(200)
236-
end
237-
end
238-
end
239-
240194
describe 'validation' do
241195
context 'when sending invalid json' do
242196
it 'fails with a 400' do
@@ -272,9 +226,6 @@ module VCAP::CloudController
272226
end
273227

274228
before do
275-
@internal_user = 'internal_user'
276-
@internal_password = 'internal_password'
277-
authorize @internal_user, @internal_password
278229
build.droplet = droplet
279230
end
280231

@@ -430,32 +381,6 @@ module VCAP::CloudController
430381
end
431382
end
432383

433-
describe 'authentication' do
434-
context 'when missing authentication' do
435-
it 'fails with authentication required' do
436-
header('Authorization', nil)
437-
post url, staging_response
438-
expect(last_response.status).to eq(401)
439-
end
440-
end
441-
442-
context 'when using invalid credentials' do
443-
it 'fails with authenticatiom required' do
444-
authorize 'bar', 'foo'
445-
post url, staging_response
446-
expect(last_response.status).to eq(401)
447-
end
448-
end
449-
450-
context 'when using valid credentials' do
451-
it 'succeeds' do
452-
allow_any_instance_of(Diego::Stager).to receive(:staging_complete)
453-
post url, MultiJson.dump(staging_response)
454-
expect(last_response.status).to eq(200)
455-
end
456-
end
457-
end
458-
459384
describe 'validation' do
460385
context 'when sending invalid json' do
461386
it 'fails with a 400' do

0 commit comments

Comments
 (0)