Skip to content
Snippets Groups Projects
Verified Commit 3a58e40a authored by Dat Tang's avatar Dat Tang Committed by GitLab
Browse files

Merge branch 'release-unique-users' into 'master'

Allow unique user creation for release environment in E2E specs

See merge request !176350



Merged-by: default avatarAndrejs Cunskis <acunskis@gitlab.com>
Approved-by: default avatarDat Tang <dattang@gitlab.com>


(cherry picked from commit 2724163f)

fe1fc078 Allow unique user creation for release environment in E2E specs

Co-authored-by: default avatarAndrejs Cunskis <acunskis@gitlab.com>
parent 00af04dd
No related branches found
No related tags found
1 merge request!176356Merge branch 'release-unique-users' into 17.7
......@@ -151,7 +151,7 @@ def reset_test_user!
#
# @return [Boolean]
def create_unique_test_user?
!Env.running_on_live_env? && !Env.personal_access_tokens_disabled? && admin_api_client
!Env.running_on_dot_com? && !Env.personal_access_tokens_disabled? && admin_api_client
end
# Create api client with provided token with fallback to UI creation of token
......
......@@ -294,7 +294,7 @@ def mock_user_get(token:, code: 200, body: { is_admin: true, id: 1, username: "r
stub_env("GITLAB_PASSWORD", password)
stub_env("GITLAB_QA_ACCESS_TOKEN", api_token)
allow(Runtime::Env).to receive(:running_on_live_env?).and_return(true)
allow(Runtime::Env).to receive(:running_on_dot_com?).and_return(true)
end
context "with personal access tokens disabled" do
......@@ -375,7 +375,7 @@ def mock_user_get(token:, code: 200, body: { is_admin: true, id: 1, username: "r
let(:user) { Resource::User.init { |usr| usr.api_client = instance_double(Runtime::API::Client) } }
before do
allow(Runtime::Env).to receive(:running_on_live_env?).and_return(false)
allow(Runtime::Env).to receive(:running_on_dot_com?).and_return(false)
described_class.instance_variable_set(:@admin_api_client, admin_api_client)
described_class.instance_variable_set(:@test_user, user)
......@@ -399,7 +399,7 @@ def mock_user_get(token:, code: 200, body: { is_admin: true, id: 1, username: "r
stub_env("GITLAB_PASSWORD", password)
stub_env("GITLAB_QA_ACCESS_TOKEN", nil)
allow(Runtime::Env).to receive(:running_on_live_env?).and_return(true)
allow(Runtime::Env).to receive(:running_on_dot_com?).and_return(true)
end
context "when api client has not been initialized" do
......@@ -502,7 +502,7 @@ def mock_user_get(token:, code: 200, body: { is_admin: true, id: 1, username: "r
let(:user) { Resource::User.new }
before do
allow(Runtime::Env).to receive(:running_on_live_env?).and_return(false)
allow(Runtime::Env).to receive(:running_on_dot_com?).and_return(false)
allow(Resource::User).to receive(:fabricate!).and_yield(user).and_return(user)
described_class.instance_variable_set(:@admin_api_client, admin_api_client)
......
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