Commit e323eb14 authored by Mark Lapierre's avatar Mark Lapierre

Resolve user variable name conflict

Resources that have a user attribute no longer override the api client
user when that attribute is populated

This also removes a bunch of assignments - the api user isn't needed
when the api client itself is already provided

Fixes move_project_create_fork_spec.rb
parent c9450eab
......@@ -18,7 +18,7 @@ module QA
attr_reader :api_resource, :api_response
attr_writer :api_client
attr_accessor :user
attr_accessor :api_user
def api_support?
respond_to?(:api_get_path) &&
......@@ -120,7 +120,7 @@ module QA
def api_client
@api_client ||= begin
Runtime::API::Client.new(:gitlab, is_new_session: !current_url.start_with?('http'), user: user)
Runtime::API::Client.new(:gitlab, is_new_session: !current_url.start_with?('http'), user: api_user)
end
end
......
......@@ -73,7 +73,7 @@ module QA
def api_post_body
{
namespace: user.username,
namespace_path: user.username,
name: name,
path: name
}
......
......@@ -9,7 +9,6 @@ module QA
attribute :sandbox do
Sandbox.fabricate_via_api! do |sandbox|
sandbox.user = user
sandbox.api_client = api_client
end
end
......
......@@ -148,7 +148,7 @@ module QA
end
def fetching_own_data?
user&.username == username || Runtime::User.username == username
api_user&.username == username || Runtime::User.username == username
end
end
end
......
......@@ -51,7 +51,6 @@ module QA
project.add_name_uuid = false
project.name = project_name
project.path_with_namespace = "#{user.username}/#{project_name}"
project.user = user
project.api_client = api_client
end
......
# frozen_string_literal: true
module QA
RSpec.describe 'Create', :orchestrated, :repository_storage, :requires_admin, quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/217002', type: :investigating } do
RSpec.describe 'Create', :orchestrated, :repository_storage, :requires_admin do
describe 'Gitaly repository storage' do
let(:user) { Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1) }
let(:parent_project) do
......@@ -30,7 +30,7 @@ module QA
parent_project.change_repository_storage(QA::Runtime::Env.additional_repository_storage)
second_fork_project = Resource::Fork.fabricate_via_api! do |fork|
fork.name = "second-fork"
fork.name = "second-fork-of-#{parent_project.name}"
fork.user = user
fork.upstream = parent_project
end.project
......
......@@ -50,7 +50,6 @@ module QA
@group = Resource::Group.fabricate_via_api! do |group|
group.path = 'template-group'
group.user = admin
group.api_client = @api_client
end
......@@ -61,7 +60,6 @@ module QA
project.description = 'Add group file templates'
project.auto_devops_enabled = false
project.initialize_with_readme = true
project.user = admin
project.api_client = @api_client
end
......@@ -72,7 +70,6 @@ module QA
commit.project = @file_template_project
commit.commit_message = 'Add group file templates'
commit.add_files(templates)
commit.user = admin
commit.api_client = @api_client
end
......@@ -82,7 +79,6 @@ module QA
project.description = 'Add files for group file templates'
project.auto_devops_enabled = false
project.initialize_with_readme = true
project.user = admin
project.api_client = @api_client
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