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>2021-08-30 15:40:01 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-08-30 15:40:01 +0300
commitf19a0fa10a0024fab5ef3c556612944f2a62c298 (patch)
treeef5c359820d2409cf07c0610122299d314ec4743 /spec/requests/api
parenteba52140851d2fb08665119c0a3997d0612ccb88 (diff)
Add latest changes from gitlab-org/security/gitlab@14-2-stable-ee
Diffstat (limited to 'spec/requests/api')
-rw-r--r--spec/requests/api/graphql/mutations/design_management/upload_spec.rb23
1 files changed, 21 insertions, 2 deletions
diff --git a/spec/requests/api/graphql/mutations/design_management/upload_spec.rb b/spec/requests/api/graphql/mutations/design_management/upload_spec.rb
index 2189ae3c519..d3e6c689a59 100644
--- a/spec/requests/api/graphql/mutations/design_management/upload_spec.rb
+++ b/spec/requests/api/graphql/mutations/design_management/upload_spec.rb
@@ -11,6 +11,7 @@ RSpec.describe "uploading designs" do
let(:project) { issue.project }
let(:files) { [fixture_file_upload("spec/fixtures/dk.png")] }
let(:variables) { {} }
+ let(:mutation_response) { graphql_mutation_response(:design_management_upload) }
def mutation
input = {
@@ -21,14 +22,32 @@ RSpec.describe "uploading designs" do
graphql_mutation(:design_management_upload, input)
end
- let(:mutation_response) { graphql_mutation_response(:design_management_upload) }
-
before do
enable_design_management
project.add_developer(current_user)
end
+ context 'when the input does not include a null value for each mapped file' do
+ let(:operations) { { query: mutation.query, variables: mutation.variables.merge(files: []) } }
+ let(:mapping) { { '1' => ['variables.files.0'] } }
+ let(:params) do
+ { '1' => files.first, operations: operations.to_json, map: mapping.to_json }
+ end
+
+ it 'returns an error' do
+ workhorse_post_with_file(api('/', current_user, version: 'graphql'),
+ params: params,
+ file_key: '1'
+ )
+
+ expect(response).to have_attributes(
+ code: eq('400'),
+ body: include('out-of-bounds')
+ )
+ end
+ end
+
it "returns an error if the user is not allowed to upload designs" do
post_graphql_mutation_with_uploads(mutation, current_user: create(:user))