Commit 18645920 authored by charlie ablett's avatar charlie ablett

Merge branch '221259-move-package-api-fixtures-to-core' into 'master'

Move package api fixture to core

See merge request gitlab-org/gitlab!36245
parents 071292b7 64915db3
......@@ -3,9 +3,15 @@
"required": ["id"],
"properties": {
"id": { "type": "integer" },
"merge_request": { "$ref": "../../../../../../../spec/fixtures/api/schemas/public_api/v4/merge_request_simple.json" },
"user": { "$ref": "../../../../../../../spec/fixtures/api/schemas/public_api/v4/user/basic.json" },
"pipeline": { "$ref": "./pipeline.json" },
"merge_request": {
"$ref": "../../../../../../../spec/fixtures/api/schemas/public_api/v4/merge_request_simple.json"
},
"user": {
"$ref": "../../../../../../../spec/fixtures/api/schemas/public_api/v4/user/basic.json"
},
"pipeline": {
"$ref": "../../../../../../../spec/fixtures/api/schemas/public_api/v4/pipeline.json"
},
"created_at": { "type": "date" },
"updated_at": { "type": "date" },
"target_branch": { "type": "string" },
......
......@@ -16,8 +16,8 @@ RSpec.describe ::Packages::Npm::PackagePresenter do
context 'for packages without dependencies' do
it { is_expected.to be_a(Hash) }
it { expect(subject[package1.version]).to match_schema('public_api/v4/packages/npm_package_version', dir: 'ee') }
it { expect(subject[package2.version]).to match_schema('public_api/v4/packages/npm_package_version', dir: 'ee') }
it { expect(subject[package1.version]).to match_schema('public_api/v4/packages/npm_package_version') }
it { expect(subject[package2.version]).to match_schema('public_api/v4/packages/npm_package_version') }
described_class::NPM_VALID_DEPENDENCY_TYPES.each do |dependency_type|
it { expect(subject.dig(package1.version, dependency_type)).to be nil }
......@@ -31,8 +31,8 @@ RSpec.describe ::Packages::Npm::PackagePresenter do
end
it { is_expected.to be_a(Hash) }
it { expect(subject[package1.version]).to match_schema('public_api/v4/packages/npm_package_version', dir: 'ee') }
it { expect(subject[package2.version]).to match_schema('public_api/v4/packages/npm_package_version', dir: 'ee') }
it { expect(subject[package1.version]).to match_schema('public_api/v4/packages/npm_package_version') }
it { expect(subject[package2.version]).to match_schema('public_api/v4/packages/npm_package_version') }
described_class::NPM_VALID_DEPENDENCY_TYPES.each do |dependency_type|
it { expect(subject.dig(package1.version, dependency_type.to_s)).to be_any }
end
......
......@@ -592,12 +592,12 @@ RSpec.describe API::NpmPackages do
def expect_a_valid_package_response
expect(response).to have_gitlab_http_status(:ok)
expect(response.media_type).to eq('application/json')
expect(response).to match_response_schema('public_api/v4/packages/npm_package', dir: 'ee')
expect(response).to match_response_schema('public_api/v4/packages/npm_package')
expect(json_response['name']).to eq(package.name)
expect(json_response['versions'][package.version]).to match_schema('public_api/v4/packages/npm_package_version', dir: 'ee')
expect(json_response['versions'][package.version]).to match_schema('public_api/v4/packages/npm_package_version')
::Packages::Npm::PackagePresenter::NPM_VALID_DEPENDENCY_TYPES.each do |dependency_type|
expect(json_response.dig('versions', package.version, dependency_type.to_s)).to be_any
end
expect(json_response['dist-tags']).to match_schema('public_api/v4/packages/npm_package_tags', dir: 'ee')
expect(json_response['dist-tags']).to match_schema('public_api/v4/packages/npm_package_tags')
end
end
......@@ -54,7 +54,7 @@ RSpec.describe API::PackageFiles do
get api(url, user)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to match_response_schema('public_api/v4/packages/package_files', dir: 'ee')
expect(response).to match_response_schema('public_api/v4/packages/package_files')
end
end
......
......@@ -152,7 +152,7 @@ RSpec.describe API::ProjectPackages do
subject
expect(response).to have_gitlab_http_status(:ok)
expect(response).to match_response_schema('public_api/v4/packages/package', dir: 'ee')
expect(response).to match_response_schema('public_api/v4/packages/package')
end
it 'returns 404 when the package does not exist' do
......@@ -194,7 +194,7 @@ RSpec.describe API::ProjectPackages do
subject
expect(response).to have_gitlab_http_status(:ok)
expect(response).to match_response_schema('public_api/v4/packages/package', dir: 'ee')
expect(response).to match_response_schema('public_api/v4/packages/package')
end
it_behaves_like 'no destroy url'
......@@ -217,7 +217,7 @@ RSpec.describe API::ProjectPackages do
get api(package_url, user)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to match_response_schema('public_api/v4/packages/package_with_build', dir: 'ee')
expect(response).to match_response_schema('public_api/v4/packages/package_with_build')
end
end
end
......
......@@ -13,7 +13,7 @@ RSpec.shared_examples 'Composer package index' do |user_type, status, add_member
subject
expect(response).to have_gitlab_http_status(status)
expect(response).to match_response_schema('packages/composer/index', dir: 'ee')
expect(response).to match_response_schema('public_api/v4/packages/composer/index')
end
end
end
......@@ -24,7 +24,7 @@ RSpec.shared_examples 'Composer empty provider index' do |user_type, status, add
subject
expect(response).to have_gitlab_http_status(status)
expect(response).to match_response_schema('packages/composer/provider', dir: 'ee')
expect(response).to match_response_schema('public_api/v4/packages/composer/provider')
expect(json_response['providers']).to eq({})
end
end
......@@ -36,7 +36,7 @@ RSpec.shared_examples 'Composer provider index' do |user_type, status, add_membe
subject
expect(response).to have_gitlab_http_status(status)
expect(response).to match_response_schema('packages/composer/provider', dir: 'ee')
expect(response).to match_response_schema('public_api/v4/packages/composer/provider')
expect(json_response['providers']).to include(package.name)
end
end
......@@ -48,7 +48,7 @@ RSpec.shared_examples 'Composer package api request' do |user_type, status, add_
subject
expect(response).to have_gitlab_http_status(status)
expect(response).to match_response_schema('packages/composer/package', dir: 'ee')
expect(response).to match_response_schema('public_api/v4/packages/composer/package')
expect(json_response['packages']).to include(package.name)
expect(json_response['packages'][package.name]).to include(package.version)
end
......
......@@ -42,7 +42,7 @@ RSpec.shared_examples 'process nuget service index request' do |user_type, statu
subject
expect(response.media_type).to eq('application/json')
expect(json_response).to match_schema('public_api/v4/packages/nuget/service_index', dir: 'ee')
expect(json_response).to match_schema('public_api/v4/packages/nuget/service_index')
expect(json_response).to be_a(Hash)
end
......@@ -59,7 +59,7 @@ RSpec.shared_examples 'returning nuget metadata json response with json schema'
subject
expect(response.media_type).to eq('application/json')
expect(json_response).to match_schema(json_schema, dir: 'ee')
expect(json_response).to match_schema(json_schema)
expect(json_response).to be_a(Hash)
end
end
......@@ -256,7 +256,7 @@ RSpec.shared_examples 'process nuget download versions request' do |user_type, s
subject
expect(response.media_type).to eq('application/json')
expect(json_response).to match_schema('public_api/v4/packages/nuget/download_versions', dir: 'ee')
expect(json_response).to match_schema('public_api/v4/packages/nuget/download_versions')
expect(json_response).to be_a(Hash)
expect(json_response['versions']).to match_array(packages.map(&:version).sort)
end
......@@ -332,7 +332,7 @@ RSpec.shared_examples 'process nuget search request' do |user_type, status, add_
expect(response.media_type).to eq('application/json')
expect(json_response).to be_a(Hash)
expect(json_response).to match_schema('public_api/v4/packages/nuget/search', dir: 'ee')
expect(json_response).to match_schema('public_api/v4/packages/nuget/search')
expect(json_response['totalHits']).to eq total_hits
expect(json_response['data'].map { |e| e['versions'].size }).to match_array(versions)
end
......
......@@ -30,7 +30,7 @@ RSpec.shared_examples 'returns package tags' do |user_type|
it 'returns two package tags' do
subject
expect(json_response).to match_schema('public_api/v4/packages/npm_package_tags', dir: 'ee')
expect(json_response).to match_schema('public_api/v4/packages/npm_package_tags')
expect(json_response.length).to eq(3) # two tags + latest (auto added)
expect(json_response[package_tag1.name]).to eq(package.version)
expect(json_response[package_tag2.name]).to eq(package.version)
......
......@@ -29,7 +29,7 @@ RSpec.shared_examples 'returns packages' do |container_type, user_type|
it 'returns a valid response schema' do
subject
expect(response).to match_response_schema(package_schema, dir: 'ee')
expect(response).to match_response_schema(package_schema)
end
it 'returns two packages' do
......@@ -56,7 +56,7 @@ RSpec.shared_examples 'returns packages with subgroups' do |container_type, user
it 'returns a valid response schema' do
subject
expect(response).to match_response_schema(package_schema, dir: 'ee')
expect(response).to match_response_schema(package_schema)
end
it 'returns three packages' do
......
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