diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-31 15:23:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-31 15:23:51 +0300 |
commit | 920cbcb38960331cd5e9315e63b2d808fd1a1e48 (patch) | |
tree | 7a20d5c4d92257557c0042e3b1b516fb44b34989 /spec/lib/gitlab/bitbucket_server_import | |
parent | 34a401c88dd94954363884f1325b92659159bdd7 (diff) |
Add latest changes from gitlab-org/gitlab@16-2-stable-ee
Diffstat (limited to 'spec/lib/gitlab/bitbucket_server_import')
-rw-r--r-- | spec/lib/gitlab/bitbucket_server_import/importer_spec.rb | 3 | ||||
-rw-r--r-- | spec/lib/gitlab/bitbucket_server_import/importers/pull_request_importer_spec.rb | 17 |
2 files changed, 20 insertions, 0 deletions
diff --git a/spec/lib/gitlab/bitbucket_server_import/importer_spec.rb b/spec/lib/gitlab/bitbucket_server_import/importer_spec.rb index 3cff2411054..4ff61bf329c 100644 --- a/spec/lib/gitlab/bitbucket_server_import/importer_spec.rb +++ b/spec/lib/gitlab/bitbucket_server_import/importer_spec.rb @@ -70,6 +70,7 @@ RSpec.describe Gitlab::BitbucketServerImport::Importer, feature_category: :impor target_branch_name: Gitlab::Git::BRANCH_REF_PREFIX + sample.target_branch, title: 'This is a title', description: 'This is a test pull request', + reviewers: [], state: 'merged', author: 'Test Author', author_email: pull_request_author.email, @@ -530,6 +531,7 @@ RSpec.describe Gitlab::BitbucketServerImport::Importer, feature_category: :impor target_branch_name: Gitlab::Git::BRANCH_REF_PREFIX + sample.target_branch, title: 'This is a title', description: 'This is a test pull request', + reviewers: sample.reviewers, state: 'merged', author: 'Test Author', author_email: pull_request_author.email, @@ -570,6 +572,7 @@ RSpec.describe Gitlab::BitbucketServerImport::Importer, feature_category: :impor target_branch_name: Gitlab::Git::BRANCH_REF_PREFIX + sample.target_branch, title: 'This is a title', description: 'This is a test pull request', + reviewers: [], state: 'merged', author: 'Test Author', author_email: project.owner.email, diff --git a/spec/lib/gitlab/bitbucket_server_import/importers/pull_request_importer_spec.rb b/spec/lib/gitlab/bitbucket_server_import/importers/pull_request_importer_spec.rb index 012cdcdd260..3c84d888c92 100644 --- a/spec/lib/gitlab/bitbucket_server_import/importers/pull_request_importer_spec.rb +++ b/spec/lib/gitlab/bitbucket_server_import/importers/pull_request_importer_spec.rb @@ -6,6 +6,8 @@ RSpec.describe Gitlab::BitbucketServerImport::Importers::PullRequestImporter, fe include AfterNextHelpers let_it_be(:project) { create(:project, :repository) } + let_it_be(:reviewer_1) { create(:user, username: 'john_smith', email: 'john@smith.com') } + let_it_be(:reviewer_2) { create(:user, username: 'jane_doe', email: 'jane@doe.com') } let(:pull_request_data) { Gitlab::Json.parse(fixture_file('importers/bitbucket_server/pull_request.json')) } let(:pull_request) { BitbucketServer::Representation::PullRequest.new(pull_request_data) } @@ -25,12 +27,27 @@ RSpec.describe Gitlab::BitbucketServerImport::Importers::PullRequestImporter, fe title: pull_request.title, source_branch: 'root/CODE_OF_CONDUCTmd-1530600625006', target_branch: 'master', + reviewer_ids: match_array([reviewer_1.id, reviewer_2.id]), state: pull_request.state, author_id: project.creator_id, description: "*Created by: #{pull_request.author}*\n\n#{pull_request.description}" ) end + context 'when the `bitbucket_server_user_mapping_by_username` flag is disabled' do + before do + stub_feature_flags(bitbucket_server_user_mapping_by_username: false) + end + + it 'imports reviewers correctly' do + importer.execute + + merge_request = project.merge_requests.find_by_iid(pull_request.iid) + + expect(merge_request.reviewer_ids).to match_array([reviewer_1.id, reviewer_2.id]) + end + end + it 'logs its progress' do expect(Gitlab::BitbucketServerImport::Logger) .to receive(:info).with(include(message: 'starting', iid: pull_request.iid)).and_call_original |