diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
commit | 6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde (patch) | |
tree | dc4d20fe6064752c0bd323187252c77e0a89144b /spec/requests/api/graphql/packages | |
parent | 9868dae7fc0655bd7ce4a6887d4e6d487690eeed (diff) |
Add latest changes from gitlab-org/gitlab@15-4-stable-eev15.4.0-rc42
Diffstat (limited to 'spec/requests/api/graphql/packages')
7 files changed, 22 insertions, 9 deletions
diff --git a/spec/requests/api/graphql/packages/composer_spec.rb b/spec/requests/api/graphql/packages/composer_spec.rb index 9830623ede8..89c01d44771 100644 --- a/spec/requests/api/graphql/packages/composer_spec.rb +++ b/spec/requests/api/graphql/packages/composer_spec.rb @@ -5,7 +5,7 @@ RSpec.describe 'package details' do include GraphqlHelpers include_context 'package details setup' - let_it_be(:package) { create(:composer_package, project: project) } + let_it_be(:package) { create(:composer_package, :last_downloaded_at, project: project) } let_it_be(:composer_json) { { name: 'name', type: 'type', license: 'license', version: 1 } } let_it_be(:composer_metadatum) do # we are forced to manually create the metadatum, without using the factory to force the sha to be a string diff --git a/spec/requests/api/graphql/packages/conan_spec.rb b/spec/requests/api/graphql/packages/conan_spec.rb index 5bd5a71bbeb..7ad85edecef 100644 --- a/spec/requests/api/graphql/packages/conan_spec.rb +++ b/spec/requests/api/graphql/packages/conan_spec.rb @@ -5,7 +5,7 @@ RSpec.describe 'conan package details' do include GraphqlHelpers include_context 'package details setup' - let_it_be(:package) { create(:conan_package, project: project) } + let_it_be(:package) { create(:conan_package, :last_downloaded_at, project: project) } let(:metadata) { query_graphql_fragment('ConanMetadata') } let(:package_files_metadata) { query_graphql_fragment('ConanFileMetadata') } diff --git a/spec/requests/api/graphql/packages/helm_spec.rb b/spec/requests/api/graphql/packages/helm_spec.rb index 1675b8faa23..79a589e2dc2 100644 --- a/spec/requests/api/graphql/packages/helm_spec.rb +++ b/spec/requests/api/graphql/packages/helm_spec.rb @@ -5,7 +5,7 @@ RSpec.describe 'helm package details' do include GraphqlHelpers include_context 'package details setup' - let_it_be(:package) { create(:helm_package, project: project) } + let_it_be(:package) { create(:helm_package, :last_downloaded_at, project: project) } let(:package_files_metadata) { query_graphql_fragment('HelmFileMetadata') } diff --git a/spec/requests/api/graphql/packages/maven_spec.rb b/spec/requests/api/graphql/packages/maven_spec.rb index 9d59a922660..b7f39efcf73 100644 --- a/spec/requests/api/graphql/packages/maven_spec.rb +++ b/spec/requests/api/graphql/packages/maven_spec.rb @@ -5,7 +5,7 @@ RSpec.describe 'maven package details' do include GraphqlHelpers include_context 'package details setup' - let_it_be(:package) { create(:maven_package, project: project) } + let_it_be(:package) { create(:maven_package, :last_downloaded_at, project: project) } let(:metadata) { query_graphql_fragment('MavenMetadata') } @@ -31,7 +31,9 @@ RSpec.describe 'maven package details' do context 'a versionless maven package' do let_it_be(:maven_metadatum) { create(:maven_metadatum, app_version: nil) } - let_it_be(:package) { create(:maven_package, project: project, version: nil, maven_metadatum: maven_metadatum) } + let_it_be(:package) do + create(:maven_package, :last_downloaded_at, project: project, version: nil, maven_metadatum: maven_metadatum) + end subject { post_graphql(query, current_user: user) } diff --git a/spec/requests/api/graphql/packages/nuget_spec.rb b/spec/requests/api/graphql/packages/nuget_spec.rb index 87cffc67ce5..7de132d1574 100644 --- a/spec/requests/api/graphql/packages/nuget_spec.rb +++ b/spec/requests/api/graphql/packages/nuget_spec.rb @@ -5,7 +5,7 @@ RSpec.describe 'nuget package details' do include GraphqlHelpers include_context 'package details setup' - let_it_be(:package) { create(:nuget_package, :with_metadatum, project: project) } + let_it_be(:package) { create(:nuget_package, :last_downloaded_at, :with_metadatum, project: project) } let_it_be(:dependency_link) { create(:packages_dependency_link, :with_nuget_metadatum, package: package) } let(:metadata) { query_graphql_fragment('NugetMetadata') } diff --git a/spec/requests/api/graphql/packages/package_spec.rb b/spec/requests/api/graphql/packages/package_spec.rb index c28b37db5af..e9f82d66775 100644 --- a/spec/requests/api/graphql/packages/package_spec.rb +++ b/spec/requests/api/graphql/packages/package_spec.rb @@ -6,8 +6,8 @@ RSpec.describe 'package details' do let_it_be_with_reload(:group) { create(:group) } let_it_be_with_reload(:project) { create(:project, group: group) } + let_it_be_with_reload(:composer_package) { create(:composer_package, :last_downloaded_at, project: project) } let_it_be(:user) { create(:user) } - let_it_be(:composer_package) { create(:composer_package, project: project) } let_it_be(:composer_json) { { name: 'name', type: 'type', license: 'license', version: 1 } } let_it_be(:composer_metadatum) do # we are forced to manually create the metadatum, without using the factory to force the sha to be a string @@ -65,6 +65,17 @@ RSpec.describe 'package details' do end end + context 'with package without last_downloaded_at' do + before do + composer_package.update!(last_downloaded_at: nil) + subject + end + + it 'matches the JSON schema' do + expect(package_details).to match_schema('graphql/packages/package_details') + end + end + context 'with package files pending destruction' do let_it_be(:package_file) { create(:package_file, package: composer_package) } let_it_be(:package_file_pending_destruction) { create(:package_file, :pending_destruction, package: composer_package) } @@ -97,7 +108,7 @@ RSpec.describe 'package details' do expect(graphql_data_at(:a, :name)).to eq(composer_package.name) - expect_graphql_errors_to_include [/Package details can be requested only for one package at a time/] + expect_graphql_errors_to_include [/"package" field can be requested only for 1 Query\(s\) at a time./] expect(graphql_data_at(:b)).to be(nil) end end diff --git a/spec/requests/api/graphql/packages/pypi_spec.rb b/spec/requests/api/graphql/packages/pypi_spec.rb index 0cc5bd2e3b2..c0e589f3597 100644 --- a/spec/requests/api/graphql/packages/pypi_spec.rb +++ b/spec/requests/api/graphql/packages/pypi_spec.rb @@ -5,7 +5,7 @@ RSpec.describe 'pypi package details' do include GraphqlHelpers include_context 'package details setup' - let_it_be(:package) { create(:pypi_package, project: project) } + let_it_be(:package) { create(:pypi_package, :last_downloaded_at, project: project) } let(:metadata) { query_graphql_fragment('PypiMetadata') } |