Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/requests/api/graphql/mutations/ci')
-rw-r--r--spec/requests/api/graphql/mutations/ci/catalog/resources/destroy_spec.rb41
-rw-r--r--spec/requests/api/graphql/mutations/ci/catalog/unpublish_spec.rb52
-rw-r--r--spec/requests/api/graphql/mutations/ci/runner/create_spec.rb2
-rw-r--r--spec/requests/api/graphql/mutations/ci/runners_registration_token/reset_spec.rb2
4 files changed, 43 insertions, 54 deletions
diff --git a/spec/requests/api/graphql/mutations/ci/catalog/resources/destroy_spec.rb b/spec/requests/api/graphql/mutations/ci/catalog/resources/destroy_spec.rb
new file mode 100644
index 00000000000..3b278f973b7
--- /dev/null
+++ b/spec/requests/api/graphql/mutations/ci/catalog/resources/destroy_spec.rb
@@ -0,0 +1,41 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe 'CatalogResourceDestroy', feature_category: :pipeline_composition do
+ include GraphqlHelpers
+
+ let_it_be(:current_user) { create(:user) }
+ let_it_be(:project) { create(:project, :catalog_resource_with_components) }
+ let_it_be(:catalog_resource) { create(:ci_catalog_resource, project: project) }
+
+ let(:mutation) do
+ variables = {
+ project_path: project.full_path
+ }
+ graphql_mutation(:catalog_resources_destroy, variables,
+ <<-QL.strip_heredoc
+ errors
+ QL
+ )
+ end
+
+ context 'when unauthorized' do
+ it_behaves_like 'a mutation that returns a top-level access error'
+ end
+
+ context 'when authorized' do
+ before do
+ catalog_resource.project.add_owner(current_user)
+ end
+
+ it 'destroys the catalog resource' do
+ expect(project.catalog_resource).to eq(catalog_resource)
+
+ post_graphql_mutation(mutation, current_user: current_user)
+
+ expect(project.reload.catalog_resource).to be_nil
+ expect_graphql_errors_to_be_empty
+ end
+ end
+end
diff --git a/spec/requests/api/graphql/mutations/ci/catalog/unpublish_spec.rb b/spec/requests/api/graphql/mutations/ci/catalog/unpublish_spec.rb
deleted file mode 100644
index 07465777263..00000000000
--- a/spec/requests/api/graphql/mutations/ci/catalog/unpublish_spec.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe 'CatalogResourceUnpublish', feature_category: :pipeline_composition do
- include GraphqlHelpers
-
- let_it_be(:current_user) { create(:user) }
- let_it_be_with_reload(:resource) { create(:ci_catalog_resource) }
-
- let(:mutation) do
- graphql_mutation(
- :catalog_resource_unpublish,
- id: resource.to_gid.to_s
- )
- end
-
- subject(:post_query) { post_graphql_mutation(mutation, current_user: current_user) }
-
- context 'when unauthorized' do
- it_behaves_like 'a mutation that returns a top-level access error'
- end
-
- context 'when authorized' do
- before_all do
- resource.project.add_owner(current_user)
- end
-
- context 'when the catalog resource is in published state' do
- it 'updates the state to draft' do
- resource.update!(state: :published)
- expect(resource.state).to eq('published')
-
- post_query
-
- expect(resource.reload.state).to eq('draft')
- expect_graphql_errors_to_be_empty
- end
- end
-
- context 'when the catalog resource is already in draft state' do
- it 'leaves the state as draft' do
- expect(resource.state).to eq('draft')
-
- post_query
-
- expect(resource.reload.state).to eq('draft')
- expect_graphql_errors_to_be_empty
- end
- end
- end
-end
diff --git a/spec/requests/api/graphql/mutations/ci/runner/create_spec.rb b/spec/requests/api/graphql/mutations/ci/runner/create_spec.rb
index b697b9f73b7..567ef12df2b 100644
--- a/spec/requests/api/graphql/mutations/ci/runner/create_spec.rb
+++ b/spec/requests/api/graphql/mutations/ci/runner/create_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe 'RunnerCreate', feature_category: :runner_fleet do
+RSpec.describe 'RunnerCreate', feature_category: :fleet_visibility do
include GraphqlHelpers
let_it_be(:user) { create(:user) }
diff --git a/spec/requests/api/graphql/mutations/ci/runners_registration_token/reset_spec.rb b/spec/requests/api/graphql/mutations/ci/runners_registration_token/reset_spec.rb
index 752242c3ab3..ef752448966 100644
--- a/spec/requests/api/graphql/mutations/ci/runners_registration_token/reset_spec.rb
+++ b/spec/requests/api/graphql/mutations/ci/runners_registration_token/reset_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe 'RunnersRegistrationTokenReset', feature_category: :runner_fleet do
+RSpec.describe 'RunnersRegistrationTokenReset', feature_category: :fleet_visibility do
include GraphqlHelpers
let(:mutation) { graphql_mutation(:runners_registration_token_reset, input) }