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
a1669a49
Commit
a1669a49
authored
Dec 02, 2021
by
Marcos Rocha
Committed by
Dylan Griffith
Dec 02, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issue adding schedule to an existing dast profile
parent
cf8bd388
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
2 deletions
+47
-2
ee/app/services/app_sec/dast/profiles/update_service.rb
ee/app/services/app_sec/dast/profiles/update_service.rb
+2
-2
ee/spec/factories/dast/profile_schedule_input_type.rb
ee/spec/factories/dast/profile_schedule_input_type.rb
+22
-0
ee/spec/graphql/mutations/dast/profiles/update_spec.rb
ee/spec/graphql/mutations/dast/profiles/update_spec.rb
+23
-0
No files found.
ee/app/services/app_sec/dast/profiles/update_service.rb
View file @
a1669a49
...
...
@@ -99,9 +99,9 @@ module AppSec
# params[:dast_profile_schedule] is `Types::Dast::ProfileScheduleInputType` object.
# Using to_h method to convert object into equivalent hash.
dast_profile_schedule_params
=
params
[
:dast_profile_schedule
]
dast_profile_schedule_params
=
params
[
:dast_profile_schedule
]
&
.
to_h
dast_profile_schedule_params
[
:user_id
]
=
current_user
.
id
unless
schedule
&
.
owner_valid?
dast_profile_schedule_params
&
.
to_h
dast_profile_schedule_params
end
def
build_auditors!
...
...
ee/spec/factories/dast/profile_schedule_input_type.rb
0 → 100644
View file @
a1669a49
# frozen_string_literal: true
FactoryBot
.
define
do
factory
:dast_profile_schedule_input_type
,
class:
'Types::Dast::ProfileScheduleInputType'
do
context
=
GraphQL
::
Query
::
Context
.
new
(
query:
GraphQL
::
Query
.
new
(
GitlabSchema
,
document:
nil
,
context:
{},
variables:
{}),
values:
{},
object:
nil
)
skip_create
arguments
=
{
active:
true
,
timezone:
ActiveSupport
::
TimeZone
.
all
.
map
{
|
tz
|
tz
.
tzinfo
.
identifier
}.
sample
,
startsAt:
Time
.
now
,
cadence:
{
unit:
%w(day month year week)
.
sample
,
duration:
1
}
}
::
Types
::
Dast
::
ProfileScheduleInputType
.
to_graphql
initialize_with
{
::
Types
::
Dast
::
ProfileScheduleInputType
.
new
(
arguments
,
defaults_used:
[],
context:
context
)
}
end
end
ee/spec/graphql/mutations/dast/profiles/update_spec.rb
View file @
a1669a49
...
...
@@ -120,6 +120,29 @@ RSpec.describe Mutations::Dast::Profiles::Update do
end
end
context
'when associated dast profile schedule is not present'
do
context
'when dast_profile_schedule param is present'
do
let
(
:new_dast_profile_schedule
)
{
create
(
:dast_profile_schedule_input_type
)
}
subject
do
mutation
.
resolve
(
**
params
.
merge
(
dast_profile_schedule:
new_dast_profile_schedule
))
end
it
'creates the profile schedule'
do
subject
new_schedule
=
dast_profile
.
reload
.
dast_profile_schedule
aggregate_failures
do
expect
(
new_schedule
.
timezone
).
to
eq
(
new_dast_profile_schedule
[
:timezone
])
expect
(
new_schedule
.
starts_at
.
to_i
).
to
eq
(
new_dast_profile_schedule
[
:starts_at
].
to_i
)
expect
(
new_schedule
.
cadence
[
:duration
]).
to
eq
(
new_dast_profile_schedule
[
:cadence
].
duration
)
expect
(
new_schedule
.
cadence
[
:unit
]).
to
eq
(
new_dast_profile_schedule
[
:cadence
].
unit
)
end
end
end
end
context
'when run_after_update=true'
do
let
(
:run_after_update
)
{
true
}
...
...
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