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
000fdbe6
Commit
000fdbe6
authored
Dec 16, 2021
by
Paul Gascou-Vaillancourt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Generate DAST profiles mocks
parent
f6ecd022
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
26 deletions
+36
-26
ee/spec/frontend/fixtures/dast_profiles.rb
ee/spec/frontend/fixtures/dast_profiles.rb
+28
-0
ee/spec/frontend/security_configuration/dast_profiles/mocks/mock_data.js
...d/security_configuration/dast_profiles/mocks/mock_data.js
+8
-26
No files found.
ee/spec/frontend/fixtures/dast_profiles.rb
View file @
000fdbe6
...
...
@@ -321,5 +321,33 @@ RSpec.describe 'DAST profiles (GraphQL fixtures)' do
expect
(
graphql_data_at
(
:project
,
:pipelines
,
:nodes
)).
to
have_attributes
(
size:
1
)
end
end
describe
'dast_profiles'
do
path
=
'security_configuration/dast_profiles/graphql/dast_profiles.query.graphql'
let_it_be
(
:dast_profiles
)
do
[
create
(
:dast_profile
,
project:
project
),
create
(
:dast_profile
,
project:
project
)
]
end
before
do
dast_profiles
.
first
.
branch_name
=
SecureRandom
.
hex
dast_profiles
.
first
.
save!
(
validate:
false
)
end
it
"graphql/
#{
path
}
.json"
do
query
=
get_graphql_query_as_string
(
path
,
ee:
true
)
post_graphql
(
query
,
current_user:
current_user
,
variables:
{
fullPath:
project
.
full_path
,
first:
20
})
expect_graphql_errors_to_be_empty
expect
(
graphql_data_at
(
:project
,
:dastProfiles
,
:edges
)).
to
have_attributes
(
size:
dast_profiles
.
length
)
end
end
end
end
ee/spec/frontend/security_configuration/dast_profiles/mocks/mock_data.js
View file @
000fdbe6
import
siteProfilesFixture
from
'
test_fixtures/graphql/security_configuration/dast_profiles/graphql/dast_site_profiles.query.graphql.basic.json
'
;
import
scannerProfilesFixtures
from
'
test_fixtures/graphql/security_configuration/dast_profiles/graphql/dast_scanner_profiles.query.graphql.basic.json
'
;
import
profilesFixtures
from
'
test_fixtures/graphql/security_configuration/dast_profiles/graphql/dast_profiles.query.graphql.json
'
;
import
policySiteProfilesFixtures
from
'
test_fixtures/graphql/security_configuration/dast_profiles/graphql/dast_site_profiles.query.graphql.from_policies.json
'
;
import
policyScannerProfilesFixtures
from
'
test_fixtures/graphql/security_configuration/dast_profiles/graphql/dast_scanner_profiles.query.graphql.from_policies.json
'
;
...
...
@@ -14,38 +15,19 @@ export const validatedSiteProfile = siteProfiles.find(
({
validationStatus
})
=>
validationStatus
===
'
PASSED_VALIDATION
'
,
);
export
const
policySiteProfiles
=
policySiteProfilesFixtures
.
data
.
project
.
siteProfiles
.
edges
.
map
(({
node
})
=>
node
)
export
const
policySiteProfiles
=
policySiteProfilesFixtures
.
data
.
project
.
siteProfiles
.
edges
.
map
(
({
node
})
=>
node
,
);
export
const
policyScannerProfiles
=
policyScannerProfilesFixtures
.
data
.
project
.
scannerProfiles
.
edges
.
map
(({
node
})
=>
node
)
export
const
policyScannerProfiles
=
policyScannerProfilesFixtures
.
data
.
project
.
scannerProfiles
.
edges
.
map
(
({
node
})
=>
node
,
);
export
const
scannerProfiles
=
scannerProfilesFixtures
.
data
.
project
.
scannerProfiles
.
edges
.
map
(
({
node
})
=>
node
,
);
export
const
savedScans
=
[
{
id
:
'
gid://gitlab/DastProfile/1
'
,
name
:
'
Scan 1
'
,
dastSiteProfile
:
siteProfiles
[
0
],
dastScannerProfile
:
scannerProfiles
[
0
],
editPath
:
'
/1/edit
'
,
branch
:
{
name
:
'
main
'
,
exists
:
true
,
},
},
{
id
:
'
gid://gitlab/DastProfile/2
'
,
name
:
'
Scan 2
'
,
dastSiteProfile
:
siteProfiles
[
1
],
dastScannerProfile
:
scannerProfiles
[
1
],
editPath
:
'
/2/edit
'
,
branch
:
{
name
:
'
feature-branch
'
,
exists
:
false
,
},
},
];
export
const
savedScans
=
profilesFixtures
.
data
.
project
.
dastProfiles
.
edges
.
map
(({
node
})
=>
node
);
export
const
failedSiteValidations
=
[
{
...
...
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