Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-03-15 15:13:34 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-03-15 15:13:34 +0300
commitb50c9d31e395afcab172d16760c5700c8cd5bcae (patch)
treeb491040bc4ab42122ec4dab7744e6e4f42276bd1 /spec/serializers
parent2cd5f04547dfda46005bae0969948174a2be72bd (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/serializers')
-rw-r--r--spec/serializers/project_import_entity_spec.rb30
1 files changed, 28 insertions, 2 deletions
diff --git a/spec/serializers/project_import_entity_spec.rb b/spec/serializers/project_import_entity_spec.rb
index 6d292d18ae7..521d0127dbb 100644
--- a/spec/serializers/project_import_entity_spec.rb
+++ b/spec/serializers/project_import_entity_spec.rb
@@ -5,10 +5,11 @@ require 'spec_helper'
RSpec.describe ProjectImportEntity, feature_category: :importers do
include ImportHelper
- let_it_be(:project) { create(:project, import_status: :started, import_source: 'namespace/project') }
+ let_it_be(:project) { create(:project, import_status: :started, import_source: 'import_user/project') }
let(:provider_url) { 'https://provider.com' }
- let(:entity) { described_class.represent(project, provider_url: provider_url) }
+ let(:client) { nil }
+ let(:entity) { described_class.represent(project, provider_url: provider_url, client: client) }
before do
create(:import_failure, project: project)
@@ -23,6 +24,31 @@ RSpec.describe ProjectImportEntity, feature_category: :importers do
expect(subject[:human_import_status_name]).to eq(project.human_import_status_name)
expect(subject[:provider_link]).to eq(provider_project_link_url(provider_url, project[:import_source]))
expect(subject[:import_error]).to eq(nil)
+ expect(subject[:relation_type]).to eq(nil)
+ end
+
+ context 'when client option present', :clean_gitlab_redis_cache do
+ let(:octokit) { instance_double(Octokit::Client, access_token: 'stub') }
+ let(:client) do
+ instance_double(
+ ::Gitlab::GithubImport::Clients::Proxy,
+ user: { login: 'import_user' }, octokit: octokit
+ )
+ end
+
+ it 'includes relation_type' do
+ expect(subject[:relation_type]).to eq('owned')
+ end
+
+ context 'with remove_legacy_github_client FF is disabled' do
+ before do
+ stub_feature_flags(remove_legacy_github_client: false)
+ end
+
+ it "doesn't include relation_type" do
+ expect(subject[:relation_type]).to eq(nil)
+ end
+ end
end
context 'when import is failed' do