diff options
-rw-r--r-- | changelogs/unreleased/georgekoltsov-51260-add-filtering-to-bitbucket-server-import.yml | 2 | ||||
-rw-r--r-- | spec/controllers/import/bitbucket_server_controller_spec.rb | 14 |
2 files changed, 14 insertions, 2 deletions
diff --git a/changelogs/unreleased/georgekoltsov-51260-add-filtering-to-bitbucket-server-import.yml b/changelogs/unreleased/georgekoltsov-51260-add-filtering-to-bitbucket-server-import.yml index 3bfbfd11249..c455b4cf642 100644 --- a/changelogs/unreleased/georgekoltsov-51260-add-filtering-to-bitbucket-server-import.yml +++ b/changelogs/unreleased/georgekoltsov-51260-add-filtering-to-bitbucket-server-import.yml @@ -1,5 +1,5 @@ --- -title: Add BitBucket project import filtering +title: Add BitBucketServer project import filtering merge_request: 31420 author: type: added diff --git a/spec/controllers/import/bitbucket_server_controller_spec.rb b/spec/controllers/import/bitbucket_server_controller_spec.rb index b89d7317b9c..e1aeab46fca 100644 --- a/spec/controllers/import/bitbucket_server_controller_spec.rb +++ b/spec/controllers/import/bitbucket_server_controller_spec.rb @@ -134,6 +134,8 @@ describe Import::BitbucketServerController do describe 'GET status' do render_views + let(:repos) { instance_double(BitbucketServer::Collection) } + before do allow(controller).to receive(:bitbucket_client).and_return(client) @@ -145,7 +147,6 @@ describe Import::BitbucketServerController do it 'assigns repository categories' do created_project = create(:project, :import_finished, import_type: 'bitbucket_server', creator_id: user.id, import_source: @created_repo.browse_url) - repos = instance_double(BitbucketServer::Collection) expect(repos).to receive(:partition).and_return([[@repo, @created_repo], [@invalid_repo]]) expect(repos).to receive(:current_page).and_return(1) @@ -159,6 +160,17 @@ describe Import::BitbucketServerController do expect(assigns(:repos)).to eq([@repo]) expect(assigns(:incompatible_repos)).to eq([@invalid_repo]) end + + context 'when filtering' do + let(:filter) { 'test' } + + it 'passes filter param to bitbucket client' do + expect(repos).to receive(:partition).and_return([[@repo, @created_repo], [@invalid_repo]]) + expect(client).to receive(:repos).with(filter: filter, limit: 25, page_offset: 0).and_return(repos) + + get :status, params: { filter: filter }, as: :json + end + end end describe 'GET jobs' do |