Commit 35752215 authored by Mark Lapierre's avatar Mark Lapierre

Merge branch 'acunskis-members-migration' into 'master'

E2E: Project member migration spec

See merge request gitlab-org/gitlab!81935
parents 33de0456 9f533aaf
......@@ -65,7 +65,7 @@ module QA
end
def marked_for_deletion?
!parse_body(api_get_from("#{api_get_path}"))[:marked_for_deletion_on].nil?
!parse_body(api_get_from(api_get_path.to_s))[:marked_for_deletion_on].nil?
end
# Get group badges
......@@ -84,22 +84,6 @@ module QA
end
end
# Get group members
#
# @return [Array<QA::Resource::User>]
def members
parse_body(api_get_from("#{api_get_path}/members")).map do |member|
User.init do |resource|
resource.api_client = api_client
resource.id = member[:id]
resource.name = member[:name]
resource.username = member[:username]
resource.email = member[:email]
resource.access_level = member[:access_level]
end
end
end
# API get path
#
# @return [String]
......
......@@ -147,39 +147,6 @@ module QA
end
end
end
context 'with group members' do
let(:member) do
Resource::User.fabricate_via_api! do |usr|
usr.api_client = admin_api_client
usr.hard_delete_on_api_removal = true
end
end
before do
member.set_public_email
source_group.add_member(member, Resource::Members::AccessLevel::DEVELOPER)
imported_group # trigger import
end
after do
member.remove_via_api!
end
it(
'adds members for imported group',
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347609'
) do
expect { imported_group.import_status }.to eventually_eq('finished').within(import_wait_duration)
imported_member = imported_group.reload!.members.find { |usr| usr.username == member.username }
aggregate_failures do
expect(imported_member).not_to be_nil
expect(imported_member.access_level).to eq(Resource::Members::AccessLevel::DEVELOPER)
end
end
end
end
end
end
# frozen_string_literal: true
require_relative 'gitlab_project_migration_common'
module QA
RSpec.describe 'Manage' do
describe 'Gitlab migration' do
include_context 'with gitlab project migration'
let(:member) do
Resource::User.fabricate_via_api! do |usr|
usr.api_client = admin_api_client
usr.hard_delete_on_api_removal = true
end
end
let(:imported_group_member) do
imported_group.reload!.list_members.find { |usr| usr['username'] == member.username }
end
let(:imported_project_member) do
imported_project.reload!.list_members.find { |usr| usr['username'] == member.username }
end
before do
member.set_public_email
end
after do
member.remove_via_api!
end
context 'with group member' do
before do
source_group.add_member(member, Resource::Members::AccessLevel::DEVELOPER)
end
it 'member retains indirect membership in imported project' do
expect_import_finished
aggregate_failures do
expect(imported_project_member).to be_nil
expect(imported_group_member&.fetch('access_level')).to eq(
Resource::Members::AccessLevel::DEVELOPER
)
end
end
end
context 'with project member' do
before do
source_project.add_member(member, Resource::Members::AccessLevel::DEVELOPER)
end
it 'member retains direct membership in imported project' do
expect_import_finished
aggregate_failures do
expect(imported_group_member).to be_nil
expect(imported_project_member&.fetch('access_level')).to eq(
Resource::Members::AccessLevel::DEVELOPER
)
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