Skip to content
Snippets Groups Projects
Commit dc889678 authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent cd52759e
No related branches found
No related tags found
No related merge requests found
Showing
with 103 additions and 107 deletions
Loading
Loading
@@ -92,7 +92,7 @@ describe('Release block', () => {
expect(wrapper.findAll('.js-assets-list li').length).toEqual(release.assets.links.length);
 
expect(wrapper.find('.js-assets-list li a').attributes().href).toEqual(
first(release.assets.links).url,
first(release.assets.links).directAssetUrl,
);
 
expect(wrapper.find('.js-assets-list li a').text()).toContain(
Loading
Loading
Loading
Loading
@@ -12,7 +12,7 @@ export const milestones = [
start_date: '2019-08-31',
web_url: 'http://0.0.0.0:3001/root/release-test/-/milestones/2',
issue_stats: {
opened: 14,
total: 33,
closed: 19,
},
},
Loading
Loading
@@ -29,7 +29,7 @@ export const milestones = [
start_date: '2019-08-19',
web_url: 'http://0.0.0.0:3001/root/release-test/-/milestones/1',
issue_stats: {
opened: 18,
total: 21,
closed: 3,
},
},
Loading
Loading
@@ -96,6 +96,7 @@ export const release = {
id: 1,
name: 'my link',
url: 'https://google.com',
direct_asset_url: 'https://redirected.google.com',
external: true,
},
{
Loading
Loading
@@ -103,6 +104,7 @@ export const release = {
name: 'my second link',
url:
'https://gitlab.com/gitlab-org/gitlab-foss/-/jobs/artifacts/v11.6.0-rc4/download?job=rspec-mysql+41%2F50',
direct_asset_url: 'https://redirected.google.com',
external: false,
},
],
Loading
Loading
Loading
Loading
@@ -56,7 +56,7 @@ describe AuthHelper do
 
describe 'any_form_based_providers_enabled?' do
before do
allow(Gitlab::Auth::LDAP::Config).to receive(:enabled?).and_return(true)
allow(Gitlab::Auth::Ldap::Config).to receive(:enabled?).and_return(true)
end
 
it 'detects form-based providers' do
Loading
Loading
Loading
Loading
@@ -2,7 +2,7 @@
 
require 'spec_helper'
 
describe Gitlab::Auth::LDAP::Access do
describe Gitlab::Auth::Ldap::Access do
include LdapHelpers
 
let(:user) { create(:omniauth_user) }
Loading
Loading
@@ -64,7 +64,7 @@ describe Gitlab::Auth::LDAP::Access do
 
context 'and the user is disabled via active directory' do
before do
allow(Gitlab::Auth::LDAP::Person).to receive(:disabled_via_active_directory?).and_return(true)
allow(Gitlab::Auth::Ldap::Person).to receive(:disabled_via_active_directory?).and_return(true)
end
 
it 'returns false' do
Loading
Loading
@@ -90,7 +90,7 @@ describe Gitlab::Auth::LDAP::Access do
 
context 'and has no disabled flag in active directory' do
before do
allow(Gitlab::Auth::LDAP::Person).to receive(:disabled_via_active_directory?).and_return(false)
allow(Gitlab::Auth::Ldap::Person).to receive(:disabled_via_active_directory?).and_return(false)
end
 
it { is_expected.to be_truthy }
Loading
Loading
@@ -135,8 +135,8 @@ describe Gitlab::Auth::LDAP::Access do
 
context 'without ActiveDirectory enabled' do
before do
allow(Gitlab::Auth::LDAP::Config).to receive(:enabled?).and_return(true)
allow_next_instance_of(Gitlab::Auth::LDAP::Config) do |instance|
allow(Gitlab::Auth::Ldap::Config).to receive(:enabled?).and_return(true)
allow_next_instance_of(Gitlab::Auth::Ldap::Config) do |instance|
allow(instance).to receive(:active_directory).and_return(false)
end
end
Loading
Loading
Loading
Loading
@@ -2,7 +2,7 @@
 
require 'spec_helper'
 
describe Gitlab::Auth::LDAP::Adapter do
describe Gitlab::Auth::Ldap::Adapter do
include LdapHelpers
 
let(:ldap) { double(:ldap) }
Loading
Loading
@@ -138,7 +138,7 @@ describe Gitlab::Auth::LDAP::Adapter do
 
it 'as many times as MAX_SEARCH_RETRIES' do
expect(ldap).to receive(:search).exactly(3).times
expect { subject }.to raise_error(Gitlab::Auth::LDAP::LDAPConnectionError)
expect { subject }.to raise_error(Gitlab::Auth::Ldap::LdapConnectionError)
end
 
context 'when no more retries' do
Loading
Loading
@@ -147,11 +147,11 @@ describe Gitlab::Auth::LDAP::Adapter do
end
 
it 'raises the exception' do
expect { subject }.to raise_error(Gitlab::Auth::LDAP::LDAPConnectionError)
expect { subject }.to raise_error(Gitlab::Auth::Ldap::LdapConnectionError)
end
 
it 'logs the error' do
expect { subject }.to raise_error(Gitlab::Auth::LDAP::LDAPConnectionError)
expect { subject }.to raise_error(Gitlab::Auth::Ldap::LdapConnectionError)
expect(Rails.logger).to have_received(:warn).with(
"LDAP search raised exception Net::LDAP::Error: some error")
end
Loading
Loading
@@ -161,6 +161,6 @@ describe Gitlab::Auth::LDAP::Adapter do
end
 
def ldap_attributes
Gitlab::Auth::LDAP::Person.ldap_attributes(Gitlab::Auth::LDAP::Config.new('ldapmain'))
Gitlab::Auth::Ldap::Person.ldap_attributes(Gitlab::Auth::Ldap::Config.new('ldapmain'))
end
end
Loading
Loading
@@ -2,7 +2,7 @@
 
require 'spec_helper'
 
describe Gitlab::Auth::LDAP::AuthHash do
describe Gitlab::Auth::Ldap::AuthHash do
include LdapHelpers
 
let(:auth_hash) do
Loading
Loading
@@ -58,7 +58,7 @@ describe Gitlab::Auth::LDAP::AuthHash do
end
 
before do
allow_next_instance_of(Gitlab::Auth::LDAP::Config) do |instance|
allow_next_instance_of(Gitlab::Auth::Ldap::Config) do |instance|
allow(instance).to receive(:attributes).and_return(attributes)
end
end
Loading
Loading
Loading
Loading
@@ -2,15 +2,15 @@
 
require 'spec_helper'
 
describe Gitlab::Auth::LDAP::Authentication do
describe Gitlab::Auth::Ldap::Authentication do
let(:dn) { 'uid=John Smith, ou=People, dc=example, dc=com' }
let(:user) { create(:omniauth_user, extern_uid: Gitlab::Auth::LDAP::Person.normalize_dn(dn)) }
let(:user) { create(:omniauth_user, extern_uid: Gitlab::Auth::Ldap::Person.normalize_dn(dn)) }
let(:login) { 'john' }
let(:password) { 'password' }
 
describe 'login' do
before do
allow(Gitlab::Auth::LDAP::Config).to receive(:enabled?).and_return(true)
allow(Gitlab::Auth::Ldap::Config).to receive(:enabled?).and_return(true)
end
 
it "finds the user if authentication is successful" do
Loading
Loading
@@ -48,7 +48,7 @@ describe Gitlab::Auth::LDAP::Authentication do
end
 
it "fails if ldap is disabled" do
allow(Gitlab::Auth::LDAP::Config).to receive(:enabled?).and_return(false)
allow(Gitlab::Auth::Ldap::Config).to receive(:enabled?).and_return(false)
expect(described_class.login(login, password)).to be_falsey
end
 
Loading
Loading
Loading
Loading
@@ -2,7 +2,7 @@
 
require 'spec_helper'
 
describe Gitlab::Auth::LDAP::Config do
describe Gitlab::Auth::Ldap::Config do
include LdapHelpers
 
let(:config) { described_class.new('ldapmain') }
Loading
Loading
Loading
Loading
@@ -2,7 +2,7 @@
 
require 'spec_helper'
 
describe Gitlab::Auth::LDAP::DN do
describe Gitlab::Auth::Ldap::DN do
using RSpec::Parameterized::TableSyntax
 
describe '#normalize_value' do
Loading
Loading
@@ -15,7 +15,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { 'John Smith,' }
 
it 'raises MalformedError' do
expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, 'DN string ended unexpectedly')
expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, 'DN string ended unexpectedly')
end
end
 
Loading
Loading
@@ -23,7 +23,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { '#aa aa' }
 
it 'raises MalformedError' do
expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, "Expected the end of an attribute value, but got \"a\"")
expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, "Expected the end of an attribute value, but got \"a\"")
end
end
 
Loading
Loading
@@ -31,7 +31,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { '#aaXaaa' }
 
it 'raises MalformedError' do
expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, "Expected the first character of a hex pair, but got \"X\"")
expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, "Expected the first character of a hex pair, but got \"X\"")
end
end
 
Loading
Loading
@@ -39,7 +39,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { '#aaaYaa' }
 
it 'raises MalformedError' do
expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, "Expected the second character of a hex pair, but got \"Y\"")
expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, "Expected the second character of a hex pair, but got \"Y\"")
end
end
 
Loading
Loading
@@ -47,7 +47,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { '"Sebasti\\cX\\a1n"' }
 
it 'raises MalformedError' do
expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, "Expected the second character of a hex pair inside a double quoted value, but got \"X\"")
expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, "Expected the second character of a hex pair inside a double quoted value, but got \"X\"")
end
end
 
Loading
Loading
@@ -55,7 +55,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { '"James' }
 
it 'raises MalformedError' do
expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, 'DN string ended unexpectedly')
expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, 'DN string ended unexpectedly')
end
end
 
Loading
Loading
@@ -63,7 +63,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { 'J\ames' }
 
it 'raises MalformedError' do
expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, 'Invalid escaped hex code "\am"')
expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, 'Invalid escaped hex code "\am"')
end
end
 
Loading
Loading
@@ -71,7 +71,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { 'foo\\' }
 
it 'raises MalformedError' do
expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, 'DN string ended unexpectedly')
expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, 'DN string ended unexpectedly')
end
end
end
Loading
Loading
@@ -88,7 +88,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { 'uid=john smith+telephonenumber=+1 555-555-5555,ou=people,dc=example,dc=com' }
 
it 'raises UnsupportedError' do
expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::UnsupportedError)
expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::UnsupportedError)
end
end
 
Loading
Loading
@@ -97,7 +97,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { 'uid = John Smith + telephoneNumber = + 1 555-555-5555 , ou = People,dc=example,dc=com' }
 
it 'raises UnsupportedError' do
expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::UnsupportedError)
expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::UnsupportedError)
end
end
 
Loading
Loading
@@ -105,7 +105,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { 'uid = John Smith + telephoneNumber = +1 555-555-5555 , ou = People,dc=example,dc=com' }
 
it 'raises UnsupportedError' do
expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::UnsupportedError)
expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::UnsupportedError)
end
end
end
Loading
Loading
@@ -117,7 +117,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { 'uid=John Smith,' }
 
it 'raises MalformedError' do
expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, 'DN string ended unexpectedly')
expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, 'DN string ended unexpectedly')
end
end
 
Loading
Loading
@@ -125,7 +125,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { '0.9.2342.19200300.100.1.25=#aa aa' }
 
it 'raises MalformedError' do
expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, "Expected the end of an attribute value, but got \"a\"")
expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, "Expected the end of an attribute value, but got \"a\"")
end
end
 
Loading
Loading
@@ -133,7 +133,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { '0.9.2342.19200300.100.1.25=#aaXaaa' }
 
it 'raises MalformedError' do
expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, "Expected the first character of a hex pair, but got \"X\"")
expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, "Expected the first character of a hex pair, but got \"X\"")
end
end
 
Loading
Loading
@@ -141,7 +141,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { '0.9.2342.19200300.100.1.25=#aaaYaa' }
 
it 'raises MalformedError' do
expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, "Expected the second character of a hex pair, but got \"Y\"")
expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, "Expected the second character of a hex pair, but got \"Y\"")
end
end
 
Loading
Loading
@@ -149,7 +149,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { 'uid="Sebasti\\cX\\a1n"' }
 
it 'raises MalformedError' do
expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, "Expected the second character of a hex pair inside a double quoted value, but got \"X\"")
expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, "Expected the second character of a hex pair inside a double quoted value, but got \"X\"")
end
end
 
Loading
Loading
@@ -157,7 +157,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { 'John' }
 
it 'raises MalformedError' do
expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, 'DN string ended unexpectedly')
expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, 'DN string ended unexpectedly')
end
end
 
Loading
Loading
@@ -165,7 +165,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { 'cn="James' }
 
it 'raises MalformedError' do
expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, 'DN string ended unexpectedly')
expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, 'DN string ended unexpectedly')
end
end
 
Loading
Loading
@@ -173,7 +173,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { 'cn=J\ames' }
 
it 'raises MalformedError' do
expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, 'Invalid escaped hex code "\am"')
expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, 'Invalid escaped hex code "\am"')
end
end
 
Loading
Loading
@@ -181,7 +181,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { 'cn=\\' }
 
it 'raises MalformedError' do
expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, 'DN string ended unexpectedly')
expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, 'DN string ended unexpectedly')
end
end
 
Loading
Loading
@@ -189,7 +189,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { '1.2.d=Value' }
 
it 'raises MalformedError' do
expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, 'Unrecognized RDN OID attribute type name character "d"')
expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, 'Unrecognized RDN OID attribute type name character "d"')
end
end
 
Loading
Loading
@@ -197,7 +197,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { 'd1.2=Value' }
 
it 'raises MalformedError' do
expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, 'Unrecognized RDN attribute type name character "."')
expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, 'Unrecognized RDN attribute type name character "."')
end
end
 
Loading
Loading
@@ -205,7 +205,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { ' -uid=John Smith' }
 
it 'raises MalformedError' do
expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, 'Unrecognized first character of an RDN attribute type name "-"')
expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, 'Unrecognized first character of an RDN attribute type name "-"')
end
end
 
Loading
Loading
@@ -213,7 +213,7 @@ describe Gitlab::Auth::LDAP::DN do
let(:given) { 'uid\\=john' }
 
it 'raises MalformedError' do
expect { subject }.to raise_error(Gitlab::Auth::LDAP::DN::MalformedError, 'Unrecognized RDN attribute type name character "\\"')
expect { subject }.to raise_error(Gitlab::Auth::Ldap::DN::MalformedError, 'Unrecognized RDN attribute type name character "\\"')
end
end
end
Loading
Loading
Loading
Loading
@@ -2,7 +2,7 @@
 
require 'spec_helper'
 
describe Gitlab::Auth::LDAP::Person do
describe Gitlab::Auth::Ldap::Person do
include LdapHelpers
 
let(:entry) { ldap_user_entry('john.doe') }
Loading
Loading
@@ -61,7 +61,7 @@ describe Gitlab::Auth::LDAP::Person do
}
}
)
config = Gitlab::Auth::LDAP::Config.new('ldapmain')
config = Gitlab::Auth::Ldap::Config.new('ldapmain')
ldap_attributes = described_class.ldap_attributes(config)
 
expect(ldap_attributes).to match_array(%w(dn uid cn mail memberof))
Loading
Loading
Loading
Loading
@@ -2,7 +2,7 @@
 
require 'spec_helper'
 
describe Gitlab::Auth::LDAP::User do
describe Gitlab::Auth::Ldap::User do
include LdapHelpers
 
let(:ldap_user) { described_class.new(auth_hash) }
Loading
Loading
Loading
Loading
@@ -22,7 +22,7 @@ describe Gitlab::Auth::OAuth::User do
}
}
end
let(:ldap_user) { Gitlab::Auth::LDAP::Person.new(Net::LDAP::Entry.new, 'ldapmain') }
let(:ldap_user) { Gitlab::Auth::Ldap::Person.new(Net::LDAP::Entry.new, 'ldapmain') }
 
describe '#persisted?' do
let!(:existing_user) { create(:omniauth_user, extern_uid: 'my-uid', provider: 'my-provider') }
Loading
Loading
@@ -230,7 +230,7 @@ describe Gitlab::Auth::OAuth::User do
 
context "and no account for the LDAP user" do
before do
allow(Gitlab::Auth::LDAP::Person).to receive(:find_by_uid).and_return(ldap_user)
allow(Gitlab::Auth::Ldap::Person).to receive(:find_by_uid).and_return(ldap_user)
 
oauth_user.save
end
Loading
Loading
@@ -269,7 +269,7 @@ describe Gitlab::Auth::OAuth::User do
let!(:existing_user) { create(:omniauth_user, name: 'John Doe', email: 'john@example.com', extern_uid: dn, provider: 'ldapmain', username: 'john') }
 
it "adds the omniauth identity to the LDAP account" do
allow(Gitlab::Auth::LDAP::Person).to receive(:find_by_uid).and_return(ldap_user)
allow(Gitlab::Auth::Ldap::Person).to receive(:find_by_uid).and_return(ldap_user)
 
oauth_user.save
 
Loading
Loading
@@ -290,8 +290,8 @@ describe Gitlab::Auth::OAuth::User do
 
context 'when an LDAP person is not found by uid' do
it 'tries to find an LDAP person by email and adds the omniauth identity to the user' do
allow(Gitlab::Auth::LDAP::Person).to receive(:find_by_uid).and_return(nil)
allow(Gitlab::Auth::LDAP::Person).to receive(:find_by_email).and_return(ldap_user)
allow(Gitlab::Auth::Ldap::Person).to receive(:find_by_uid).and_return(nil)
allow(Gitlab::Auth::Ldap::Person).to receive(:find_by_email).and_return(ldap_user)
 
oauth_user.save
 
Loading
Loading
@@ -301,9 +301,9 @@ describe Gitlab::Auth::OAuth::User do
 
context 'when also not found by email' do
it 'tries to find an LDAP person by DN and adds the omniauth identity to the user' do
allow(Gitlab::Auth::LDAP::Person).to receive(:find_by_uid).and_return(nil)
allow(Gitlab::Auth::LDAP::Person).to receive(:find_by_email).and_return(nil)
allow(Gitlab::Auth::LDAP::Person).to receive(:find_by_dn).and_return(ldap_user)
allow(Gitlab::Auth::Ldap::Person).to receive(:find_by_uid).and_return(nil)
allow(Gitlab::Auth::Ldap::Person).to receive(:find_by_email).and_return(nil)
allow(Gitlab::Auth::Ldap::Person).to receive(:find_by_dn).and_return(ldap_user)
 
oauth_user.save
 
Loading
Loading
@@ -344,7 +344,7 @@ describe Gitlab::Auth::OAuth::User do
 
context 'and no account for the LDAP user' do
it 'creates a user favoring the LDAP username and strips email domain' do
allow(Gitlab::Auth::LDAP::Person).to receive(:find_by_uid).and_return(ldap_user)
allow(Gitlab::Auth::Ldap::Person).to receive(:find_by_uid).and_return(ldap_user)
 
oauth_user.save
 
Loading
Loading
@@ -356,7 +356,7 @@ describe Gitlab::Auth::OAuth::User do
 
context "and no corresponding LDAP person" do
before do
allow(Gitlab::Auth::LDAP::Person).to receive(:find_by_uid).and_return(nil)
allow(Gitlab::Auth::Ldap::Person).to receive(:find_by_uid).and_return(nil)
end
 
include_examples "to verify compliance with allow_single_sign_on"
Loading
Loading
@@ -405,13 +405,13 @@ describe Gitlab::Auth::OAuth::User do
allow(ldap_user).to receive(:username) { uid }
allow(ldap_user).to receive(:email) { ['johndoe@example.com', 'john2@example.com'] }
allow(ldap_user).to receive(:dn) { dn }
allow(Gitlab::Auth::LDAP::Person).to receive(:find_by_uid).and_return(ldap_user)
allow(Gitlab::Auth::Ldap::Person).to receive(:find_by_uid).and_return(ldap_user)
end
 
context "and no account for the LDAP user" do
context 'dont block on create (LDAP)' do
before do
allow_next_instance_of(Gitlab::Auth::LDAP::Config) do |instance|
allow_next_instance_of(Gitlab::Auth::Ldap::Config) do |instance|
allow(instance).to receive_messages(block_auto_created_users: false)
end
end
Loading
Loading
@@ -425,7 +425,7 @@ describe Gitlab::Auth::OAuth::User do
 
context 'block on create (LDAP)' do
before do
allow_next_instance_of(Gitlab::Auth::LDAP::Config) do |instance|
allow_next_instance_of(Gitlab::Auth::Ldap::Config) do |instance|
allow(instance).to receive_messages(block_auto_created_users: true)
end
end
Loading
Loading
@@ -443,7 +443,7 @@ describe Gitlab::Auth::OAuth::User do
 
context 'dont block on create (LDAP)' do
before do
allow_next_instance_of(Gitlab::Auth::LDAP::Config) do |instance|
allow_next_instance_of(Gitlab::Auth::Ldap::Config) do |instance|
allow(instance).to receive_messages(block_auto_created_users: false)
end
end
Loading
Loading
@@ -457,7 +457,7 @@ describe Gitlab::Auth::OAuth::User do
 
context 'block on create (LDAP)' do
before do
allow_next_instance_of(Gitlab::Auth::LDAP::Config) do |instance|
allow_next_instance_of(Gitlab::Auth::Ldap::Config) do |instance|
allow(instance).to receive_messages(block_auto_created_users: true)
end
end
Loading
Loading
@@ -503,7 +503,7 @@ describe Gitlab::Auth::OAuth::User do
 
context 'dont block on create (LDAP)' do
before do
allow_next_instance_of(Gitlab::Auth::LDAP::Config) do |instance|
allow_next_instance_of(Gitlab::Auth::Ldap::Config) do |instance|
allow(instance).to receive_messages(block_auto_created_users: false)
end
end
Loading
Loading
@@ -517,7 +517,7 @@ describe Gitlab::Auth::OAuth::User do
 
context 'block on create (LDAP)' do
before do
allow_next_instance_of(Gitlab::Auth::LDAP::Config) do |instance|
allow_next_instance_of(Gitlab::Auth::Ldap::Config) do |instance|
allow(instance).to receive_messages(block_auto_created_users: true)
end
end
Loading
Loading
@@ -806,7 +806,7 @@ describe Gitlab::Auth::OAuth::User do
end
 
it 'returns nil' do
adapter = Gitlab::Auth::LDAP::Adapter.new('ldapmain')
adapter = Gitlab::Auth::Ldap::Adapter.new('ldapmain')
hash = OmniAuth::AuthHash.new(uid: 'whatever', provider: 'ldapmain')
 
expect(oauth_user.send(:find_ldap_person, hash, adapter)).to be_nil
Loading
Loading
Loading
Loading
@@ -19,7 +19,7 @@ describe Gitlab::Auth::Saml::User do
email: 'john@mail.com'
}
end
let(:ldap_user) { Gitlab::Auth::LDAP::Person.new(Net::LDAP::Entry.new, 'ldapmain') }
let(:ldap_user) { Gitlab::Auth::Ldap::Person.new(Net::LDAP::Entry.new, 'ldapmain') }
 
describe '#save' do
before do
Loading
Loading
@@ -161,10 +161,10 @@ describe Gitlab::Auth::Saml::User do
allow(ldap_user).to receive(:username) { uid }
allow(ldap_user).to receive(:email) { %w(john@mail.com john2@example.com) }
allow(ldap_user).to receive(:dn) { dn }
allow(Gitlab::Auth::LDAP::Adapter).to receive(:new).and_return(adapter)
allow(Gitlab::Auth::LDAP::Person).to receive(:find_by_uid).with(uid, adapter).and_return(ldap_user)
allow(Gitlab::Auth::LDAP::Person).to receive(:find_by_dn).with(dn, adapter).and_return(ldap_user)
allow(Gitlab::Auth::LDAP::Person).to receive(:find_by_email).with('john@mail.com', adapter).and_return(ldap_user)
allow(Gitlab::Auth::Ldap::Adapter).to receive(:new).and_return(adapter)
allow(Gitlab::Auth::Ldap::Person).to receive(:find_by_uid).with(uid, adapter).and_return(ldap_user)
allow(Gitlab::Auth::Ldap::Person).to receive(:find_by_dn).with(dn, adapter).and_return(ldap_user)
allow(Gitlab::Auth::Ldap::Person).to receive(:find_by_email).with('john@mail.com', adapter).and_return(ldap_user)
end
 
context 'and no account for the LDAP user' do
Loading
Loading
@@ -212,10 +212,10 @@ describe Gitlab::Auth::Saml::User do
nil_types = uid_types - [uid_type]
 
nil_types.each do |type|
allow(Gitlab::Auth::LDAP::Person).to receive(:"find_by_#{type}").and_return(nil)
allow(Gitlab::Auth::Ldap::Person).to receive(:"find_by_#{type}").and_return(nil)
end
 
allow(Gitlab::Auth::LDAP::Person).to receive(:"find_by_#{uid_type}").and_return(ldap_user)
allow(Gitlab::Auth::Ldap::Person).to receive(:"find_by_#{uid_type}").and_return(ldap_user)
end
 
it 'adds the omniauth identity to the LDAP account' do
Loading
Loading
@@ -282,7 +282,7 @@ describe Gitlab::Auth::Saml::User do
it 'adds the LDAP identity to the existing SAML user' do
create(:omniauth_user, email: 'john@mail.com', extern_uid: dn, provider: 'saml', username: 'john')
 
allow(Gitlab::Auth::LDAP::Person).to receive(:find_by_uid).with(dn, adapter).and_return(ldap_user)
allow(Gitlab::Auth::Ldap::Person).to receive(:find_by_uid).with(dn, adapter).and_return(ldap_user)
 
local_hash = OmniAuth::AuthHash.new(uid: dn, provider: provider, info: info_hash)
local_saml_user = described_class.new(local_hash)
Loading
Loading
Loading
Loading
@@ -590,23 +590,23 @@ describe Gitlab::Auth, :use_clean_rails_memory_store_caching do
 
context "with ldap enabled" do
before do
allow(Gitlab::Auth::LDAP::Config).to receive(:enabled?).and_return(true)
allow(Gitlab::Auth::Ldap::Config).to receive(:enabled?).and_return(true)
end
 
it "tries to autheticate with db before ldap" do
expect(Gitlab::Auth::LDAP::Authentication).not_to receive(:login)
expect(Gitlab::Auth::Ldap::Authentication).not_to receive(:login)
 
expect(gl_auth.find_with_user_password(username, password)).to eq(user)
end
 
it "does not find user by using ldap as fallback to for authentication" do
expect(Gitlab::Auth::LDAP::Authentication).to receive(:login).and_return(nil)
expect(Gitlab::Auth::Ldap::Authentication).to receive(:login).and_return(nil)
 
expect(gl_auth.find_with_user_password('ldap_user', 'password')).to be_nil
end
 
it "find new user by using ldap as fallback to for authentication" do
expect(Gitlab::Auth::LDAP::Authentication).to receive(:login).and_return(user)
expect(Gitlab::Auth::Ldap::Authentication).to receive(:login).and_return(user)
 
expect(gl_auth.find_with_user_password('ldap_user', 'password')).to eq(user)
end
Loading
Loading
@@ -623,7 +623,7 @@ describe Gitlab::Auth, :use_clean_rails_memory_store_caching do
 
context "with ldap enabled" do
before do
allow(Gitlab::Auth::LDAP::Config).to receive(:enabled?).and_return(true)
allow(Gitlab::Auth::Ldap::Config).to receive(:enabled?).and_return(true)
end
 
it "does not find non-ldap user by valid login/password" do
Loading
Loading
Loading
Loading
@@ -54,16 +54,15 @@ describe ::Gitlab::BareRepositoryImport::Repository do
end
 
context 'hashed storage' do
let(:gitlab_shell) { Gitlab::Shell.new }
let(:repository_storage) { 'default' }
let(:root_path) { Gitlab.config.repositories.storages[repository_storage].legacy_disk_path }
let(:hash) { '6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b' }
let(:hashed_path) { "@hashed/6b/86/6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b" }
let(:root_path) { TestEnv.repos_path }
let(:repo_path) { File.join(root_path, "#{hashed_path}.git") }
let(:wiki_path) { File.join(root_path, "#{hashed_path}.wiki.git") }
 
before do
gitlab_shell.create_repository(repository_storage, hashed_path, 'group/project')
TestEnv.create_bare_repository(repo_path)
Gitlab::GitalyClient::StorageSettings.allow_disk_access do
repository = Rugged::Repository.new(repo_path)
repository.config['gitlab.fullpath'] = 'to/repo'
Loading
Loading
@@ -71,7 +70,7 @@ describe ::Gitlab::BareRepositoryImport::Repository do
end
 
after do
gitlab_shell.remove_repository(repository_storage, hashed_path)
FileUtils.rm_rf(repo_path)
end
 
subject { described_class.new(root_path, repo_path) }
Loading
Loading
Loading
Loading
@@ -500,11 +500,11 @@ describe Gitlab::Git::Repository, :seed_helper do
subject { new_repository.fetch_repository_as_mirror(repository) }
 
before do
Gitlab::Shell.new.create_repository('default', 'my_project', 'group/project')
new_repository.create_repository
end
 
after do
Gitlab::Shell.new.remove_repository('default', 'my_project')
new_repository.remove
end
 
it 'fetches a repository as a mirror remote' do
Loading
Loading
Loading
Loading
@@ -4197,7 +4197,7 @@ describe User, :do_not_mock_admin_mode do
describe '#read_only_attribute?' do
context 'when LDAP server is enabled' do
before do
allow(Gitlab::Auth::LDAP::Config).to receive(:enabled?).and_return(true)
allow(Gitlab::Auth::Ldap::Config).to receive(:enabled?).and_return(true)
end
 
%i[name email location].each do |attribute|
Loading
Loading
Loading
Loading
@@ -639,8 +639,8 @@ describe 'Git HTTP requests' do
 
context 'when LDAP is configured' do
before do
allow(Gitlab::Auth::LDAP::Config).to receive(:enabled?).and_return(true)
allow_any_instance_of(Gitlab::Auth::LDAP::Authentication)
allow(Gitlab::Auth::Ldap::Config).to receive(:enabled?).and_return(true)
allow_any_instance_of(Gitlab::Auth::Ldap::Authentication)
.to receive(:login).and_return(nil)
end
 
Loading
Loading
@@ -862,8 +862,8 @@ describe 'Git HTTP requests' do
 
before do
allow(Gitlab::Auth::OAuth::Provider).to receive(:enabled?).and_return(true)
allow_any_instance_of(Gitlab::Auth::LDAP::Authentication).to receive(:login).and_return(nil)
allow_any_instance_of(Gitlab::Auth::LDAP::Authentication).to receive(:login).with(user.username, user.password).and_return(user)
allow_any_instance_of(Gitlab::Auth::Ldap::Authentication).to receive(:login).and_return(nil)
allow_any_instance_of(Gitlab::Auth::Ldap::Authentication).to receive(:login).with(user.username, user.password).and_return(user)
end
 
it_behaves_like 'pulls require Basic HTTP Authentication'
Loading
Loading
Loading
Loading
@@ -6,7 +6,6 @@ describe Projects::CreateService, '#execute' do
include ExternalAuthorizationServiceHelpers
include GitHelpers
 
let(:gitlab_shell) { Gitlab::Shell.new }
let(:user) { create :user }
let(:opts) do
{
Loading
Loading
@@ -264,8 +263,6 @@ describe Projects::CreateService, '#execute' do
end
 
context 'when another repository already exists on disk' do
let(:repository_storage) { 'default' }
let(:opts) do
{
name: 'Existing',
Loading
Loading
@@ -274,13 +271,15 @@ describe Projects::CreateService, '#execute' do
end
 
context 'with legacy storage' do
let(:fake_repo_path) { File.join(TestEnv.repos_path, user.namespace.full_path, 'existing.git') }
before do
stub_application_setting(hashed_storage_enabled: false)
gitlab_shell.create_repository(repository_storage, "#{user.namespace.full_path}/existing", 'group/project')
TestEnv.create_bare_repository(fake_repo_path)
end
 
after do
gitlab_shell.remove_repository(repository_storage, "#{user.namespace.full_path}/existing")
FileUtils.rm_rf(fake_repo_path)
end
 
it 'does not allow to create a project when path matches existing repository on disk' do
Loading
Loading
@@ -305,17 +304,15 @@ describe Projects::CreateService, '#execute' do
context 'with hashed storage' do
let(:hash) { '6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b' }
let(:hashed_path) { '@hashed/6b/86/6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b' }
let(:fake_repo_path) { File.join(TestEnv.repos_path, "#{hashed_path}.git") }
 
before do
allow(Digest::SHA2).to receive(:hexdigest) { hash }
end
before do
gitlab_shell.create_repository(repository_storage, hashed_path, 'group/project')
TestEnv.create_bare_repository(fake_repo_path)
end
 
after do
gitlab_shell.remove_repository(repository_storage, hashed_path)
FileUtils.rm_rf(fake_repo_path)
end
 
it 'does not allow to create a project when path matches existing repository on disk' do
Loading
Loading
Loading
Loading
@@ -4,7 +4,6 @@ require 'spec_helper'
 
describe Projects::ForkService do
include ProjectForksHelper
include Gitlab::ShellAdapter
 
shared_examples 'forks count cache refresh' do
it 'flushes the forks count cache of the source project', :clean_gitlab_redis_cache do
Loading
Loading
@@ -135,17 +134,16 @@ describe Projects::ForkService do
end
 
context 'repository in legacy storage already exists' do
let(:repository_storage) { 'default' }
let(:repository_storage_path) { Gitlab.config.repositories.storages[repository_storage].legacy_disk_path }
let(:fake_repo_path) { File.join(TestEnv.repos_path, @to_user.namespace.full_path, "#{@from_project.path}.git") }
let(:params) { { namespace: @to_user.namespace } }
 
before do
stub_application_setting(hashed_storage_enabled: false)
gitlab_shell.create_repository(repository_storage, "#{@to_user.namespace.full_path}/#{@from_project.path}", "#{@to_user.namespace.full_path}/#{@from_project.path}")
TestEnv.create_bare_repository(fake_repo_path)
end
 
after do
gitlab_shell.remove_repository(repository_storage, "#{@to_user.namespace.full_path}/#{@from_project.path}")
FileUtils.rm_rf(fake_repo_path)
end
 
subject { fork_project(@from_project, @to_user, params) }
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment