diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 19:00:14 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 19:00:14 +0000 |
commit | 05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2 (patch) | |
tree | 11d0f2a6ec31c7793c184106cedc2ded3d9a2cc5 /spec/lib/gitlab/github_import/client_spec.rb | |
parent | ec73467c23693d0db63a797d10194da9e72a74af (diff) | |
download | gitlab-ce-05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2.tar.gz |
Add latest changes from gitlab-org/gitlab@15-8-stable-eev15.8.0-rc42
Diffstat (limited to 'spec/lib/gitlab/github_import/client_spec.rb')
-rw-r--r-- | spec/lib/gitlab/github_import/client_spec.rb | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/spec/lib/gitlab/github_import/client_spec.rb b/spec/lib/gitlab/github_import/client_spec.rb index 526a8721ff3..d69bc4d60ee 100644 --- a/spec/lib/gitlab/github_import/client_spec.rb +++ b/spec/lib/gitlab/github_import/client_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::Client do +RSpec.describe Gitlab::GithubImport::Client, feature_category: :importer do subject(:client) { described_class.new('foo', parallel: parallel) } let(:parallel) { true } @@ -614,6 +614,46 @@ RSpec.describe Gitlab::GithubImport::Client do client.search_repos_by_name_graphql('test') end + context 'when relation type option present' do + context 'when relation type is owned' do + let(:expected_query) { 'test in:name is:public,private user:user' } + + it 'searches for repositories within the organization based on name' do + expect(client.octokit).to receive(:post).with( + '/graphql', { query: expected_graphql }.to_json + ) + + client.search_repos_by_name_graphql('test', relation_type: 'owned') + end + end + + context 'when relation type is organization' do + let(:expected_query) { 'test in:name is:public,private org:test-login' } + + it 'searches for repositories within the organization based on name' do + expect(client.octokit).to receive(:post).with( + '/graphql', { query: expected_graphql }.to_json + ) + + client.search_repos_by_name_graphql( + 'test', relation_type: 'organization', organization_login: 'test-login' + ) + end + end + + context 'when relation type is collaborated' do + let(:expected_query) { 'test in:name is:public,private repo:repo1 repo:repo2' } + + it 'searches for collaborated repositories based on name' do + expect(client.octokit).to receive(:post).with( + '/graphql', { query: expected_graphql }.to_json + ) + + client.search_repos_by_name_graphql('test', relation_type: 'collaborated') + end + end + end + context 'when pagination options present' do context 'with "first" option' do let(:expected_graphql_params) do |