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:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-12-12 09:10:45 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-12-12 09:10:45 +0300
commitd89147da045b9d00c4e35de3c7b39ed2b02ef7a6 (patch)
treee5adaeb09829e7109ccabc97fc5d395c75e47027 /spec/requests/api/graphql
parentfdc2b6184d20e767f089557f3cdc68837a6aacfb (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests/api/graphql')
-rw-r--r--spec/requests/api/graphql/mutations/organizations/create_spec.rb8
-rw-r--r--spec/requests/api/graphql/mutations/organizations/update_spec.rb30
2 files changed, 34 insertions, 4 deletions
diff --git a/spec/requests/api/graphql/mutations/organizations/create_spec.rb b/spec/requests/api/graphql/mutations/organizations/create_spec.rb
index bffabd6c2ed..8ab80685822 100644
--- a/spec/requests/api/graphql/mutations/organizations/create_spec.rb
+++ b/spec/requests/api/graphql/mutations/organizations/create_spec.rb
@@ -4,6 +4,7 @@ require 'spec_helper'
RSpec.describe Mutations::Organizations::Create, feature_category: :cell do
include GraphqlHelpers
+ include WorkhorseHelpers
let_it_be(:user) { create(:user) }
@@ -11,14 +12,16 @@ RSpec.describe Mutations::Organizations::Create, feature_category: :cell do
let(:name) { 'Name' }
let(:path) { 'path' }
let(:description) { nil }
+ let(:avatar) { fixture_file_upload("spec/fixtures/dk.png") }
let(:params) do
{
name: name,
- path: path
+ path: path,
+ avatar: avatar
}
end
- subject(:create_organization) { post_graphql_mutation(mutation, current_user: current_user) }
+ subject(:create_organization) { post_graphql_mutation_with_uploads(mutation, current_user: current_user) }
it { expect(described_class).to require_graphql_authorizations(:create_organization) }
@@ -28,6 +31,7 @@ RSpec.describe Mutations::Organizations::Create, feature_category: :cell do
context 'when the user does not have permission' do
let(:current_user) { nil }
+ let(:avatar) { nil }
it_behaves_like 'a mutation that returns a top-level access error'
diff --git a/spec/requests/api/graphql/mutations/organizations/update_spec.rb b/spec/requests/api/graphql/mutations/organizations/update_spec.rb
index 573a7227e3c..4e819c280d0 100644
--- a/spec/requests/api/graphql/mutations/organizations/update_spec.rb
+++ b/spec/requests/api/graphql/mutations/organizations/update_spec.rb
@@ -4,6 +4,7 @@ require 'spec_helper'
RSpec.describe Mutations::Organizations::Update, feature_category: :cell do
include GraphqlHelpers
+ include WorkhorseHelpers
let_it_be(:user) { create(:user) }
let_it_be_with_reload(:organization) do
@@ -14,16 +15,18 @@ RSpec.describe Mutations::Organizations::Update, feature_category: :cell do
let(:name) { 'Name' }
let(:path) { 'path' }
let(:description) { 'org-description' }
+ let(:avatar) { nil }
let(:params) do
{
id: organization.to_global_id.to_s,
name: name,
path: path,
- description: description
+ description: description,
+ avatar: avatar
}
end
- subject(:update_organization) { post_graphql_mutation(mutation, current_user: current_user) }
+ subject(:update_organization) { post_graphql_mutation_with_uploads(mutation, current_user: current_user) }
it { expect(described_class).to require_graphql_authorizations(:admin_organization) }
@@ -90,5 +93,28 @@ RSpec.describe Mutations::Organizations::Update, feature_category: :cell do
)
expect(mutation_response['errors']).to be_empty
end
+
+ context 'with a new avatar' do
+ let(:filename) { 'spec/fixtures/dk.png' }
+ let(:avatar) { fixture_file_upload(filename) }
+
+ it 'returns the updated organization' do
+ update_organization
+
+ expect(
+ graphql_data_at(:organization_update, :organization)
+ ).to(
+ match(
+ a_hash_including(
+ 'name' => name,
+ 'path' => path,
+ 'description' => description
+ )
+ )
+ )
+ expect(File.basename(organization.reload.avatar.file.file)).to eq(File.basename(filename))
+ expect(mutation_response['errors']).to be_empty
+ end
+ end
end
end