Commit 32deb045 authored by charlie ablett's avatar charlie ablett

Merge branch 'xanf-fix-bitbucket-server-importer-key' into 'master'

Resolve "BitBucket Server import using name instead of key"

See merge request gitlab-org/gitlab!39433
parents 5e45c4fb 1e4d2c81
# frozen_string_literal: true
class Import::BitbucketServerProviderRepoEntity < Import::BitbucketProviderRepoEntity
expose :id, override: true do |repo|
"#{repo.project_key}/#{repo.slug}"
end
expose :provider_link, override: true do |repo, options|
repo.browse_url
end
......
---
title: Fix failing bitbucket server import when project slug differs from name
merge_request: 39433
author:
type: fixed
......@@ -139,8 +139,6 @@ RSpec.describe Import::BitbucketServerController do
describe 'GET status' do
render_views
let(:repos) { instance_double(BitbucketServer::Collection) }
before do
allow(controller).to receive(:client).and_return(client)
......@@ -157,14 +155,14 @@ RSpec.describe Import::BitbucketServerController do
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['incompatible_repos'].length).to eq(1)
expect(json_response.dig("incompatible_repos", 0, "id")).to eq(@invalid_repo.full_name)
expect(json_response.dig("incompatible_repos", 0, "id")).to eq("#{@invalid_repo.project_key}/#{@invalid_repo.slug}")
expect(json_response['provider_repos'].length).to eq(1)
expect(json_response.dig("provider_repos", 0, "id")).to eq(@repo.full_name)
end
it_behaves_like 'import controller status' do
let(:repo) { @repo }
let(:repo_id) { @repo.full_name }
let(:repo_id) { "#{@repo.project_key}/#{@repo.slug}" }
let(:import_source) { @repo.browse_url }
let(:provider_name) { 'bitbucket_server' }
let(:client_repos_field) { :repos }
......
......@@ -6,8 +6,10 @@ RSpec.describe Import::BitbucketServerProviderRepoEntity do
let(:repo_data) do
{
'name' => 'test',
'slug' => 'TEST',
'project' => {
'name' => 'demo'
'name' => 'demo',
'key' => 'DEM'
},
'links' => {
'self' => [
......@@ -27,7 +29,7 @@ RSpec.describe Import::BitbucketServerProviderRepoEntity do
it_behaves_like 'exposes required fields for import entity' do
let(:expected_values) do
{
id: 'demo/test',
id: 'DEM/TEST',
full_name: 'demo/test',
sanitized_name: 'test',
provider_link: 'http://local.bitbucket.server/demo/test.git'
......
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