Commit b3874294 authored by Michael Kozono's avatar Michael Kozono

Refactor

parent a738a446
...@@ -152,8 +152,4 @@ class Projects::GitHttpClientController < Projects::ApplicationController ...@@ -152,8 +152,4 @@ class Projects::GitHttpClientController < Projects::ApplicationController
def has_authentication_ability?(capability) def has_authentication_ability?(capability)
(authentication_abilities || []).include?(capability) (authentication_abilities || []).include?(capability)
end end
def authentication_project
authentication_result.project
end
end end
...@@ -23,30 +23,30 @@ describe Gitlab::GitAccess, lib: true do ...@@ -23,30 +23,30 @@ describe Gitlab::GitAccess, lib: true do
context 'ssh disabled' do context 'ssh disabled' do
before do before do
disable_protocol('ssh') disable_protocol('ssh')
@acc = Gitlab::GitAccess.new(actor, project, 'ssh', authentication_abilities: authentication_abilities)
end end
it 'blocks ssh git push' do it 'blocks ssh git push' do
expect(@acc.check('git-receive-pack', '_any').allowed?).to be_falsey expect(access.check('git-receive-pack', '_any').allowed?).to be_falsey
end end
it 'blocks ssh git pull' do it 'blocks ssh git pull' do
expect(@acc.check('git-upload-pack', '_any').allowed?).to be_falsey expect(access.check('git-upload-pack', '_any').allowed?).to be_falsey
end end
end end
context 'http disabled' do context 'http disabled' do
let(:protocol) { 'http' }
before do before do
disable_protocol('http') disable_protocol('http')
@acc = Gitlab::GitAccess.new(actor, project, 'http', authentication_abilities: authentication_abilities)
end end
it 'blocks http push' do it 'blocks http push' do
expect(@acc.check('git-receive-pack', '_any').allowed?).to be_falsey expect(access.check('git-receive-pack', '_any').allowed?).to be_falsey
end end
it 'blocks http git pull' do it 'blocks http git pull' do
expect(@acc.check('git-upload-pack', '_any').allowed?).to be_falsey expect(access.check('git-upload-pack', '_any').allowed?).to be_falsey
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment