Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
9b4291a5
Commit
9b4291a5
authored
Aug 10, 2020
by
Philip Cunningham
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use enriched id type in on-demand scan mutation
Swaps ID for DastSiteProfileID in create mutation.
parent
2acd7ff3
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
17 deletions
+25
-17
doc/api/graphql/reference/gitlab_schema.graphql
doc/api/graphql/reference/gitlab_schema.graphql
+1
-1
doc/api/graphql/reference/gitlab_schema.json
doc/api/graphql/reference/gitlab_schema.json
+1
-1
ee/app/assets/javascripts/on_demand_scans/graphql/dast_on_demand_scan_create.mutation.graphql
...scans/graphql/dast_on_demand_scan_create.mutation.graphql
+1
-1
ee/app/graphql/mutations/dast_on_demand_scans/create.rb
ee/app/graphql/mutations/dast_on_demand_scans/create.rb
+2
-6
ee/spec/graphql/mutations/dast_on_demand_scans/create_spec.rb
...pec/graphql/mutations/dast_on_demand_scans/create_spec.rb
+0
-8
ee/spec/requests/api/graphql/mutations/dast_on_demand_scans/create_spec.rb
...api/graphql/mutations/dast_on_demand_scans/create_spec.rb
+20
-0
No files found.
doc/api/graphql/reference/gitlab_schema.graphql
View file @
9b4291a5
...
...
@@ -2319,7 +2319,7 @@ input DastOnDemandScanCreateInput {
"""
ID
of
the
site
profile
to
be
used
for
the
scan
.
"""
dastSiteProfileId
:
ID
!
dastSiteProfileId
:
DastSiteProfile
ID
!
"""
The
project
the
site
profile
belongs
to
.
...
...
doc/api/graphql/reference/gitlab_schema.json
View file @
9b4291a5
...
...
@@ -6212,7 +6212,7 @@
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "ID",
"name": "
DastSiteProfile
ID",
"ofType": null
}
},
ee/app/assets/javascripts/on_demand_scans/graphql/dast_on_demand_scan_create.mutation.graphql
View file @
9b4291a5
mutation
dastOnDemandScanCreate
(
$fullPath
:
ID
!,
$dastSiteProfileId
:
ID
!)
{
mutation
dastOnDemandScanCreate
(
$fullPath
:
ID
!,
$dastSiteProfileId
:
DastSiteProfile
ID
!)
{
dastOnDemandScanCreate
(
input
:
{
fullPath
:
$fullPath
,
dastSiteProfileId
:
$dastSiteProfileId
})
{
pipelineUrl
errors
...
...
ee/app/graphql/mutations/dast_on_demand_scans/create.rb
View file @
9b4291a5
...
...
@@ -17,7 +17,7 @@ module Mutations
required:
true
,
description:
'The project the site profile belongs to.'
argument
:dast_site_profile_id
,
GraphQL
::
ID_TYPE
,
argument
:dast_site_profile_id
,
::
Types
::
GlobalIDType
[
::
DastSiteProfile
]
,
required:
true
,
description:
'ID of the site profile to be used for the scan.'
...
...
@@ -47,14 +47,10 @@ module Mutations
end
def
find_dast_site_profile
(
project
:,
dast_site_profile_id
:)
global_id
=
GlobalID
.
parse
(
dast_site_profile_id
)
raise
InvalidGlobalID
.
new
(
'Incorrect class'
)
unless
global_id
.
model_class
==
DastSiteProfile
project
.
dast_site_profiles
.
with_dast_site
.
find
(
global
_id
.
model_id
)
.
find
(
dast_site_profile
_id
.
model_id
)
end
def
success_response
(
project
:,
pipeline
:)
...
...
ee/spec/graphql/mutations/dast_on_demand_scans/create_spec.rb
View file @
9b4291a5
...
...
@@ -90,14 +90,6 @@ RSpec.describe Mutations::DastOnDemandScans::Create do
expect
(
actual_url
).
to
eq
(
expected_url
)
end
context
'when the wrong type of gid is used'
do
let
(
:dast_site_profile_id
)
{
project
.
to_global_id
}
it
'raises an exception'
do
expect
{
subject
}.
to
raise_error
(
described_class
::
InvalidGlobalID
)
end
end
context
'when the dast_site_profile does not exist'
do
it
'raises an exception'
do
dast_site_profile
.
destroy!
...
...
ee/spec/requests/api/graphql/mutations/dast_on_demand_scans/create_spec.rb
View file @
9b4291a5
...
...
@@ -53,6 +53,26 @@ RSpec.describe 'Running a DAST Scan' do
expect
(
mutation_response
[
'pipelineUrl'
]).
to
eq
(
expected_url
)
end
context
'when wrong type of global id is passed'
do
let
(
:mutation
)
do
graphql_mutation
(
:dast_on_demand_scan_create
,
full_path:
full_path
,
dast_site_profile_id:
dast_site_profile
.
dast_site
.
to_global_id
.
to_s
)
end
it_behaves_like
'a mutation that returns top-level errors'
do
let
(
:match_errors
)
do
gid
=
dast_site_profile
.
dast_site
.
to_global_id
eq
([
"Variable $dastOnDemandScanCreateInput of type DastOnDemandScanCreateInput! "
\
"was provided invalid value for dastSiteProfileId (
\"
#{
gid
}
\"
does not "
\
"represent an instance of DastSiteProfile)"
])
end
end
end
context
'when pipeline creation fails'
do
before
do
allow_any_instance_of
(
Ci
::
Pipeline
).
to
receive
(
:created_successfully?
).
and_return
(
false
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment