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
7ef723e5
Commit
7ef723e5
authored
Dec 07, 2020
by
Paul Slaughter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Merge branch '246892-auto-select-dast-profile' into 'master'"
This reverts merge request !48940
parent
0255e321
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
66 additions
and
195 deletions
+66
-195
ee/app/assets/javascripts/on_demand_scans/components/on_demand_scans_form.vue
...ripts/on_demand_scans/components/on_demand_scans_form.vue
+15
-40
ee/app/assets/javascripts/on_demand_scans/components/profile_selector/profile_selector.vue
...nd_scans/components/profile_selector/profile_selector.vue
+8
-10
ee/app/assets/javascripts/on_demand_scans/components/profile_selector/scanner_profile_selector.vue
.../components/profile_selector/scanner_profile_selector.vue
+2
-2
ee/app/assets/javascripts/on_demand_scans/components/profile_selector/site_profile_selector.vue
...ans/components/profile_selector/site_profile_selector.vue
+2
-2
ee/changelogs/unreleased/246892-auto-select-dast-profile.yml
ee/changelogs/unreleased/246892-auto-select-dast-profile.yml
+0
-5
ee/spec/frontend/on_demand_scans/components/on_demand_scans_form_spec.js
...d/on_demand_scans/components/on_demand_scans_form_spec.js
+20
-77
ee/spec/frontend/on_demand_scans/components/profile_selector/__snapshots__/scanner_profile_selector_spec.js.snap
...ector/__snapshots__/scanner_profile_selector_spec.js.snap
+1
-1
ee/spec/frontend/on_demand_scans/components/profile_selector/__snapshots__/site_profile_selector_spec.js.snap
...selector/__snapshots__/site_profile_selector_spec.js.snap
+1
-1
ee/spec/frontend/on_demand_scans/components/profile_selector/profile_selector_spec.js
...cans/components/profile_selector/profile_selector_spec.js
+7
-5
ee/spec/frontend/on_demand_scans/components/profile_selector/scanner_profile_selector_spec.js
...ponents/profile_selector/scanner_profile_selector_spec.js
+4
-4
ee/spec/frontend/on_demand_scans/components/profile_selector/site_profile_selector_spec.js
...components/profile_selector/site_profile_selector_spec.js
+4
-4
ee/spec/frontend/on_demand_scans/mock_data.js
ee/spec/frontend/on_demand_scans/mock_data.js
+0
-4
ee/spec/frontend/on_demand_scans/mocks/apollo_mocks.js
ee/spec/frontend/on_demand_scans/mocks/apollo_mocks.js
+0
-38
ee/spec/frontend/security_configuration/dast_scanner_profiles_form/components/dast_scanner_profiles_form_spec.js
...ofiles_form/components/dast_scanner_profiles_form_spec.js
+1
-1
ee/spec/frontend/security_configuration/dast_site_profiles_form/components/dast_site_profile_form_spec.js
...e_profiles_form/components/dast_site_profile_form_spec.js
+1
-1
No files found.
ee/app/assets/javascripts/on_demand_scans/components/on_demand_scans_form.vue
View file @
7ef723e5
...
...
@@ -30,7 +30,7 @@ import ProfileSelectorSummaryCell from './profile_selector/summary_cell.vue';
import
ScannerProfileSelector
from
'
./profile_selector/scanner_profile_selector.vue
'
;
import
SiteProfileSelector
from
'
./profile_selector/site_profile_selector.vue
'
;
const
createProfilesApolloOptions
=
(
name
,
field
,
{
fetchQuery
,
fetchError
})
=>
({
const
createProfilesApolloOptions
=
(
name
,
{
fetchQuery
,
fetchError
})
=>
({
query
:
fetchQuery
,
variables
()
{
return
{
...
...
@@ -39,9 +39,6 @@ const createProfilesApolloOptions = (name, field, { fetchQuery, fetchError }) =>
},
update
(
data
)
{
const
edges
=
data
?.
project
?.[
name
]?.
edges
??
[];
if
(
edges
.
length
===
1
)
{
this
[
field
]
=
edges
[
0
].
node
.
id
;
}
return
edges
.
map
(({
node
})
=>
node
);
},
error
(
e
)
{
...
...
@@ -69,16 +66,8 @@ export default {
},
mixins
:
[
glFeatureFlagsMixin
()],
apollo
:
{
scannerProfiles
:
createProfilesApolloOptions
(
'
scannerProfiles
'
,
'
selectedScannerProfileId
'
,
SCANNER_PROFILES_QUERY
,
),
siteProfiles
:
createProfilesApolloOptions
(
'
siteProfiles
'
,
'
selectedSiteProfileId
'
,
SITE_PROFILES_QUERY
,
),
scannerProfiles
:
createProfilesApolloOptions
(
'
scannerProfiles
'
,
SCANNER_PROFILES_QUERY
),
siteProfiles
:
createProfilesApolloOptions
(
'
siteProfiles
'
,
SITE_PROFILES_QUERY
),
},
props
:
{
helpPagePath
:
{
...
...
@@ -115,8 +104,8 @@ export default {
return
{
scannerProfiles
:
[],
siteProfiles
:
[],
selectedScannerProfile
Id
:
null
,
selectedSiteProfile
Id
:
null
,
selectedScannerProfile
:
null
,
selectedSiteProfile
:
null
,
loading
:
false
,
errorType
:
null
,
errors
:
[],
...
...
@@ -124,16 +113,6 @@ export default {
};
},
computed
:
{
selectedScannerProfile
()
{
return
this
.
selectedScannerProfileId
?
this
.
scannerProfiles
.
find
(({
id
})
=>
id
===
this
.
selectedScannerProfileId
)
:
null
;
},
selectedSiteProfile
()
{
return
this
.
selectedSiteProfileId
?
this
.
siteProfiles
.
find
(({
id
})
=>
id
===
this
.
selectedSiteProfileId
)
:
null
;
},
errorMessage
()
{
return
ERROR_MESSAGES
[
this
.
errorType
]
||
null
;
},
...
...
@@ -259,37 +238,37 @@ export default {
</template>
<
template
v-else-if=
"!failedToLoadProfiles"
>
<scanner-profile-selector
v-model=
"selectedScannerProfile
Id
"
v-model=
"selectedScannerProfile"
class=
"gl-mb-5"
:profiles=
"scannerProfiles"
>
<template
v-if=
"selectedScannerProfile"
#summary
>
<template
#summary
="
{ profile }"
>
<div
class=
"row"
>
<profile-selector-summary-cell
:class=
"
{ 'gl-text-red-500': hasProfilesConflict }"
:label="s__('DastProfiles|Scan mode')"
:value="$options.SCAN_TYPE_LABEL[
selectedScannerP
rofile.scanType]"
:value="$options.SCAN_TYPE_LABEL[
p
rofile.scanType]"
/>
</div>
<div
class=
"row"
>
<profile-selector-summary-cell
:label=
"s__('DastProfiles|Spider timeout')"
:value=
"n__('%d minute', '%d minutes',
selectedScannerP
rofile.spiderTimeout)"
:value=
"n__('%d minute', '%d minutes',
p
rofile.spiderTimeout)"
/>
<profile-selector-summary-cell
:label=
"s__('DastProfiles|Target timeout')"
:value=
"n__('%d second', '%d seconds',
selectedScannerP
rofile.targetTimeout)"
:value=
"n__('%d second', '%d seconds',
p
rofile.targetTimeout)"
/>
</div>
<div
class=
"row"
>
<profile-selector-summary-cell
:label=
"s__('DastProfiles|AJAX spider')"
:value=
"
selectedScannerP
rofile.useAjaxSpider ? __('On') : __('Off')"
:value=
"
p
rofile.useAjaxSpider ? __('On') : __('Off')"
/>
<profile-selector-summary-cell
:label=
"s__('DastProfiles|Debug messages')"
:value=
"
selectedScannerP
rofile.showDebugMessages
p
rofile.showDebugMessages
? s__('DastProfiles|Show debug messages')
: s__('DastProfiles|Hide debug messages')
"
...
...
@@ -297,17 +276,13 @@ export default {
</div>
</
template
>
</scanner-profile-selector>
<site-profile-selector
v-model=
"selectedSiteProfileId"
class=
"gl-mb-5"
:profiles=
"siteProfiles"
>
<
template
v-if=
"selectedSiteProfile"
#summary
>
<site-profile-selector
v-model=
"selectedSiteProfile"
class=
"gl-mb-5"
:profiles=
"siteProfiles"
>
<
template
#summary=
"{ profile }"
>
<div
class=
"row"
>
<profile-selector-summary-cell
:class=
"
{ 'gl-text-red-500': hasProfilesConflict }"
:label="s__('DastProfiles|Target URL')"
:value="
selectedSiteP
rofile.targetUrl"
:value="
p
rofile.targetUrl"
/>
</div>
</
template
>
...
...
ee/app/assets/javascripts/on_demand_scans/components/profile_selector/profile_selector.vue
View file @
7ef723e5
...
...
@@ -25,14 +25,14 @@ export default {
default
:
()
=>
[],
},
value
:
{
type
:
String
,
type
:
Object
,
required
:
false
,
default
:
null
,
},
},
computed
:
{
selectedProfile
(
)
{
return
this
.
value
?
this
.
profiles
.
find
(({
id
})
=>
this
.
value
===
id
)
:
null
;
methods
:
{
isChecked
({
id
}
)
{
return
this
.
value
?.
id
===
id
;
},
},
};
...
...
@@ -67,9 +67,7 @@ export default {
</
template
>
<gl-dropdown
:text=
"
selectedProfile
? selectedProfile.dropdownLabel
: s__('OnDemandScans|Select one of the existing profiles')
value ? value.dropdownLabel : s__('OnDemandScans|Select one of the existing profiles')
"
class=
"mw-460"
data-testid=
"profiles-dropdown"
...
...
@@ -77,9 +75,9 @@ export default {
<gl-dropdown-item
v-for=
"profile in profiles"
:key=
"profile.id"
:is-checked=
"
value === profile.id
"
:is-checked=
"
isChecked(profile)
"
is-check-item
@
click=
"$emit('input', profile
.id
)"
@
click=
"$emit('input', profile)"
>
{{ profile.profileName }}
</gl-dropdown-item>
...
...
@@ -89,7 +87,7 @@ export default {
data-testid=
"selected-profile-summary"
class=
"gl-mt-6 gl-pt-6 gl-border-t-solid gl-border-gray-100 gl-border-t-1"
>
<slot
name=
"summary"
></slot>
<slot
name=
"summary"
:profile=
"value"
></slot>
</div>
</gl-form-group>
<
template
v-else
>
...
...
ee/app/assets/javascripts/on_demand_scans/components/profile_selector/scanner_profile_selector.vue
View file @
7ef723e5
...
...
@@ -57,8 +57,8 @@ export default {
)
}}
</
template
>
<
template
#new-profile
>
{{
s__
(
'
OnDemandScans|Create a new scanner profile
'
)
}}
</
template
>
<
template
#summary
>
<slot
name=
"summary"
></slot>
<
template
#summary
=
"{ profile }"
>
<slot
name=
"summary"
:profile=
"profile"
></slot>
</
template
>
</profile-selector>
</template>
ee/app/assets/javascripts/on_demand_scans/components/profile_selector/site_profile_selector.vue
View file @
7ef723e5
...
...
@@ -60,8 +60,8 @@ export default {
)
}}
</
template
>
<
template
#new-profile
>
{{
s__
(
'
OnDemandScans|Create a new site profile
'
)
}}
</
template
>
<
template
#summary
>
<slot
name=
"summary"
></slot>
<
template
#summary
=
"{ profile }"
>
<slot
name=
"summary"
:profile=
"profile"
></slot>
</
template
>
</profile-selector>
</template>
ee/changelogs/unreleased/246892-auto-select-dast-profile.yml
deleted
100644 → 0
View file @
0255e321
---
title
:
'
On-demand
scans:
automatically
select
DAST
profile
when
only
one
is
available'
merge_request
:
48940
author
:
type
:
changed
ee/spec/frontend/on_demand_scans/components/on_demand_scans_form_spec.js
View file @
7ef723e5
import
{
GlForm
,
GlSkeletonLoader
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
,
mount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
,
mount
}
from
'
@vue/test-utils
'
;
import
{
merge
}
from
'
lodash
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
createApolloProvider
from
'
helpers/mock_apollo_helper
'
;
import
OnDemandScansForm
from
'
ee/on_demand_scans/components/on_demand_scans_form.vue
'
;
import
ScannerProfileSelector
from
'
ee/on_demand_scans/components/profile_selector/scanner_profile_selector.vue
'
;
import
SiteProfileSelector
from
'
ee/on_demand_scans/components/profile_selector/site_profile_selector.vue
'
;
import
dastOnDemandScanCreate
from
'
ee/on_demand_scans/graphql/dast_on_demand_scan_create.mutation.graphql
'
;
import
dastScannerProfilesQuery
from
'
ee/security_configuration/dast_profiles/graphql/dast_scanner_profiles.query.graphql
'
;
import
dastSiteProfilesQuery
from
'
ee/security_configuration/dast_profiles/graphql/dast_site_profiles.query.graphql
'
;
import
*
as
responses
from
'
../mocks/apollo_mocks
'
;
import
{
scannerProfiles
,
siteProfiles
}
from
'
../mocks/mock_data
'
;
import
{
redirectTo
}
from
'
~/lib/utils/url_utility
'
;
import
{
scannerProfiles
,
siteProfiles
}
from
'
../mock_data
'
;
const
helpPagePath
=
'
/application_security/dast/index#on-demand-scans
'
;
const
projectPath
=
'
group/project
'
;
...
...
@@ -27,6 +22,17 @@ const defaultProps = {
defaultBranch
,
};
const
defaultMocks
=
{
$apollo
:
{
mutate
:
jest
.
fn
(),
queries
:
{
scannerProfiles
:
{},
siteProfiles
:
{},
},
addSmartQuery
:
jest
.
fn
(),
},
};
const
pipelineUrl
=
`/
${
projectPath
}
/pipelines/123`
;
const
[
passiveScannerProfile
,
activeScannerProfile
]
=
scannerProfiles
;
const
[
nonValidatedSiteProfile
,
validatedSiteProfile
]
=
siteProfiles
;
...
...
@@ -37,9 +43,7 @@ jest.mock('~/lib/utils/url_utility', () => ({
}));
describe
(
'
OnDemandScansForm
'
,
()
=>
{
let
localVue
;
let
subject
;
let
requestHandlers
;
const
findForm
=
()
=>
subject
.
find
(
GlForm
);
const
findByTestId
=
testId
=>
subject
.
find
(
`[data-testid="
${
testId
}
"]`
);
...
...
@@ -48,44 +52,13 @@ describe('OnDemandScansForm', () => {
const
findSubmitButton
=
()
=>
findByTestId
(
'
on-demand-scan-submit-button
'
);
const
setValidFormData
=
()
=>
{
subject
.
find
(
ScannerProfileSelector
).
vm
.
$emit
(
'
input
'
,
passiveScannerProfile
.
id
);
subject
.
find
(
SiteProfileSelector
).
vm
.
$emit
(
'
input
'
,
nonValidatedSiteProfile
.
id
);
subject
.
find
(
ScannerProfileSelector
).
vm
.
$emit
(
'
input
'
,
passiveScannerProfile
);
subject
.
find
(
SiteProfileSelector
).
vm
.
$emit
(
'
input
'
,
nonValidatedSiteProfile
);
return
subject
.
vm
.
$nextTick
();
};
const
submitForm
=
()
=>
findForm
().
vm
.
$emit
(
'
submit
'
,
{
preventDefault
:
()
=>
{}
});
const
createMockApolloProvider
=
handlers
=>
{
localVue
.
use
(
VueApollo
);
requestHandlers
=
{
dastScannerProfiles
:
jest
.
fn
().
mockResolvedValue
(
responses
.
dastScannerProfiles
()),
dastSiteProfiles
:
jest
.
fn
().
mockResolvedValue
(
responses
.
dastSiteProfiles
()),
...
handlers
,
};
return
createApolloProvider
([
[
dastScannerProfilesQuery
,
requestHandlers
.
dastScannerProfiles
],
[
dastSiteProfilesQuery
,
requestHandlers
.
dastSiteProfiles
],
]);
};
const
subjectMounterFactory
=
(
mountFn
=
shallowMount
)
=>
(
options
=
{},
withHandlers
)
=>
{
localVue
=
createLocalVue
();
let
defaultMocks
=
{
$apollo
:
{
mutate
:
jest
.
fn
(),
queries
:
{
scannerProfiles
:
{},
siteProfiles
:
{},
},
addSmartQuery
:
jest
.
fn
(),
},
};
let
apolloProvider
;
if
(
withHandlers
)
{
apolloProvider
=
createMockApolloProvider
(
withHandlers
);
defaultMocks
=
{};
}
const
subjectMounterFactory
=
(
mountFn
=
shallowMount
)
=>
(
options
=
{})
=>
{
subject
=
mountFn
(
OnDemandScansForm
,
merge
(
...
...
@@ -103,7 +76,7 @@ describe('OnDemandScansForm', () => {
},
},
},
{
...
options
,
localVue
,
apolloProvider
}
,
options
,
{
data
()
{
return
{
...
options
.
data
};
...
...
@@ -270,8 +243,8 @@ describe('OnDemandScansForm', () => {
'
profiles conflict prevention
'
,
({
description
,
selectedScannerProfile
,
selectedSiteProfile
,
hasConflict
})
=>
{
const
setFormData
=
()
=>
{
subject
.
find
(
ScannerProfileSelector
).
vm
.
$emit
(
'
input
'
,
selectedScannerProfile
.
id
);
subject
.
find
(
SiteProfileSelector
).
vm
.
$emit
(
'
input
'
,
selectedSiteProfile
.
id
);
subject
.
find
(
ScannerProfileSelector
).
vm
.
$emit
(
'
input
'
,
selectedScannerProfile
);
subject
.
find
(
SiteProfileSelector
).
vm
.
$emit
(
'
input
'
,
selectedSiteProfile
);
return
subject
.
vm
.
$nextTick
();
};
...
...
@@ -280,12 +253,7 @@ describe('OnDemandScansForm', () => {
?
`warns about conflicting profiles when user selects
${
description
}
`
:
`does not report any conflict when user selects
${
description
}
`
,
async
()
=>
{
mountShallowSubject
({
data
:
{
scannerProfiles
,
siteProfiles
,
},
});
mountShallowSubject
();
await
setFormData
();
expect
(
findProfilesConflictAlert
().
exists
()).
toBe
(
hasConflict
);
...
...
@@ -301,10 +269,6 @@ describe('OnDemandScansForm', () => {
securityOnDemandScansSiteValidation
:
false
,
},
},
data
:
{
scannerProfiles
,
siteProfiles
,
},
});
return
setFormData
();
});
...
...
@@ -316,25 +280,4 @@ describe('OnDemandScansForm', () => {
});
},
);
describe
.
each
`
profileType | query | selector | profiles
${
'
scanner
'
}
|
${
'
dastScannerProfiles
'
}
|
${
ScannerProfileSelector
}
|
${
scannerProfiles
}
${
'
site
'
}
|
${
'
dastSiteProfiles
'
}
|
${
SiteProfileSelector
}
|
${
siteProfiles
}
`
(
'
when there is a single $profileType profile
'
,
({
query
,
selector
,
profiles
})
=>
{
const
[
profile
]
=
profiles
;
beforeEach
(()
=>
{
mountShallowSubject
(
{},
{
[
query
]:
jest
.
fn
().
mockResolvedValue
(
responses
[
query
]([
profile
])),
},
);
});
it
(
'
automatically selects the only available profile
'
,
()
=>
{
expect
(
subject
.
find
(
selector
).
attributes
(
'
value
'
)).
toBe
(
profile
.
id
);
});
});
});
ee/spec/frontend/on_demand_scans/components/profile_selector/__snapshots__/scanner_profile_selector_spec.js.snap
View file @
7ef723e5
...
...
@@ -4,7 +4,7 @@ exports[`OnDemandScansScannerProfileSelector renders properly with profiles 1`]
<div
class="gl-card"
data-foo="bar"
value="
gid://gitlab/DastScannerProfile/1
"
value="
[object Object]
"
>
<div
class="gl-card-header"
...
...
ee/spec/frontend/on_demand_scans/components/profile_selector/__snapshots__/site_profile_selector_spec.js.snap
View file @
7ef723e5
...
...
@@ -4,7 +4,7 @@ exports[`OnDemandScansSiteProfileSelector renders properly with profiles 1`] = `
<div
class="gl-card"
data-foo="bar"
value="
gid://gitlab/DastSiteProfile/1
"
value="
[object Object]
"
>
<div
class="gl-card-header"
...
...
ee/spec/frontend/on_demand_scans/components/profile_selector/profile_selector_spec.js
View file @
7ef723e5
...
...
@@ -2,7 +2,7 @@ import { GlDropdownItem } from '@gitlab/ui';
import
{
mount
}
from
'
@vue/test-utils
'
;
import
{
merge
}
from
'
lodash
'
;
import
OnDemandScansProfileSelector
from
'
ee/on_demand_scans/components/profile_selector/profile_selector.vue
'
;
import
{
scannerProfiles
}
from
'
../../mock
s/mock
_data
'
;
import
{
scannerProfiles
}
from
'
../../mock_data
'
;
describe
(
'
OnDemandScansProfileSelector
'
,
()
=>
{
let
wrapper
;
...
...
@@ -41,10 +41,12 @@ describe('OnDemandScansProfileSelector', () => {
slots
:
{
title
:
'
Section title
'
,
label
:
'
Use existing scanner profile
'
,
summary
:
`<div>Profile's summary</div>`
,
'
no-profiles
'
:
'
No profile yet
'
,
'
new-profile
'
:
'
Create a new profile
'
,
},
scopedSlots
:
{
summary
:
"
<div>{{ props.profile.profileName }}'s summary</div>
"
,
},
},
options
,
),
...
...
@@ -103,7 +105,7 @@ describe('OnDemandScansProfileSelector', () => {
it
(
'
when a profile is selected, input event is emitted
'
,
async
()
=>
{
await
selectFirstProfile
();
expect
(
wrapper
.
emitted
(
'
input
'
)).
toEqual
([[
scannerProfiles
[
0
]
.
id
]]);
expect
(
wrapper
.
emitted
(
'
input
'
)).
toEqual
([[
scannerProfiles
[
0
]]]);
});
it
(
'
shows dropdown items for each profile
'
,
()
=>
{
...
...
@@ -128,7 +130,7 @@ describe('OnDemandScansProfileSelector', () => {
createFullComponent
({
propsData
:
{
profiles
:
scannerProfiles
,
value
:
selectedProfile
.
id
,
value
:
selectedProfile
,
},
});
});
...
...
@@ -137,7 +139,7 @@ describe('OnDemandScansProfileSelector', () => {
const
summary
=
findSelectedProfileSummary
();
expect
(
summary
.
exists
()).
toBe
(
true
);
expect
(
summary
.
text
()).
toContain
(
`
Profile
's summary`
);
expect
(
summary
.
text
()).
toContain
(
`
${
scannerProfiles
[
0
].
profileName
}
's summary`
);
});
it
(
'
displays item as checked
'
,
()
=>
{
...
...
ee/spec/frontend/on_demand_scans/components/profile_selector/scanner_profile_selector_spec.js
View file @
7ef723e5
...
...
@@ -2,7 +2,7 @@ import { mount, shallowMount } from '@vue/test-utils';
import
{
merge
}
from
'
lodash
'
;
import
ProfileSelector
from
'
ee/on_demand_scans/components/profile_selector/profile_selector.vue
'
;
import
OnDemandScansScannerProfileSelector
from
'
ee/on_demand_scans/components/profile_selector/scanner_profile_selector.vue
'
;
import
{
scannerProfiles
}
from
'
../../mock
s/mock
_data
'
;
import
{
scannerProfiles
}
from
'
../../mock_data
'
;
const
TEST_LIBRARY_PATH
=
'
/test/scanner/profiles/library/path
'
;
const
TEST_NEW_PATH
=
'
/test/new/scanner/profile/path
'
;
...
...
@@ -31,8 +31,8 @@ describe('OnDemandScansScannerProfileSelector', () => {
newScannerProfilePath
:
TEST_NEW_PATH
,
glFeatures
:
{
securityOnDemandScansSiteValidation
:
true
},
},
slots
:
{
summary
:
`<div>
${
profiles
[
0
].
profileName
}
's summary</div>`
,
s
copedS
lots
:
{
summary
:
'
<div slot-scope="{ profile }">{{ profile.profileName }}
\'
s summary</div>
'
,
},
},
options
,
...
...
@@ -50,7 +50,7 @@ describe('OnDemandScansScannerProfileSelector', () => {
it
(
'
renders properly with profiles
'
,
()
=>
{
createFullComponent
({
propsData
:
{
profiles
,
value
:
profiles
[
0
]
.
id
},
propsData
:
{
profiles
,
value
:
profiles
[
0
]
},
});
expect
(
wrapper
.
element
).
toMatchSnapshot
();
...
...
ee/spec/frontend/on_demand_scans/components/profile_selector/site_profile_selector_spec.js
View file @
7ef723e5
...
...
@@ -2,7 +2,7 @@ import { mount, shallowMount } from '@vue/test-utils';
import
{
merge
}
from
'
lodash
'
;
import
ProfileSelector
from
'
ee/on_demand_scans/components/profile_selector/profile_selector.vue
'
;
import
OnDemandScansSiteProfileSelector
from
'
ee/on_demand_scans/components/profile_selector/site_profile_selector.vue
'
;
import
{
siteProfiles
}
from
'
../../mock
s/mock
_data
'
;
import
{
siteProfiles
}
from
'
../../mock_data
'
;
const
TEST_LIBRARY_PATH
=
'
/test/site/profiles/library/path
'
;
const
TEST_NEW_PATH
=
'
/test/new/site/profile/path
'
;
...
...
@@ -34,8 +34,8 @@ describe('OnDemandScansSiteProfileSelector', () => {
newSiteProfilePath
:
TEST_NEW_PATH
,
glFeatures
:
{
securityOnDemandScansSiteValidation
:
true
},
},
slots
:
{
summary
:
`<div>
${
profiles
[
0
].
profileName
}
's summary</div>`
,
s
copedS
lots
:
{
summary
:
'
<div slot-scope="{ profile }">{{ profile.profileName }}
\'
s summary</div>
'
,
},
},
options
,
...
...
@@ -53,7 +53,7 @@ describe('OnDemandScansSiteProfileSelector', () => {
it
(
'
renders properly with profiles
'
,
()
=>
{
createFullComponent
({
propsData
:
{
profiles
,
value
:
profiles
[
0
]
.
id
},
propsData
:
{
profiles
,
value
:
profiles
[
0
]
},
});
expect
(
wrapper
.
element
).
toMatchSnapshot
();
...
...
ee/spec/frontend/on_demand_scans/mock
s/mock
_data.js
→
ee/spec/frontend/on_demand_scans/mock_data.js
View file @
7ef723e5
...
...
@@ -7,7 +7,6 @@ export const scannerProfiles = [
scanType
:
'
PASSIVE
'
,
useAjaxSpider
:
false
,
showDebugMessages
:
false
,
editPath
:
'
/scanner_profile/edit/1
'
,
},
{
id
:
'
gid://gitlab/DastScannerProfile/2
'
,
...
...
@@ -17,7 +16,6 @@ export const scannerProfiles = [
scanType
:
'
ACTIVE
'
,
useAjaxSpider
:
true
,
showDebugMessages
:
true
,
editPath
:
'
/scanner_profile/edit/2
'
,
},
];
...
...
@@ -26,14 +24,12 @@ export const siteProfiles = [
id
:
'
gid://gitlab/DastSiteProfile/1
'
,
profileName
:
'
Site profile #1
'
,
targetUrl
:
'
https://foo.com
'
,
editPath
:
'
/site_profiles/edit/1
'
,
validationStatus
:
'
PENDING_VALIDATION
'
,
},
{
id
:
'
gid://gitlab/DastSiteProfile/2
'
,
profileName
:
'
Site profile #2
'
,
targetUrl
:
'
https://bar.com
'
,
editPath
:
'
/site_profiles/edit/2
'
,
validationStatus
:
'
PASSED_VALIDATION
'
,
},
];
ee/spec/frontend/on_demand_scans/mocks/apollo_mocks.js
deleted
100644 → 0
View file @
0255e321
import
{
scannerProfiles
,
siteProfiles
}
from
'
./mock_data
'
;
const
defaults
=
{
pageInfo
:
{
hasNextPage
:
false
,
hasPreviousPage
:
false
,
startCursor
:
null
,
endCursor
:
null
,
},
};
export
const
dastScannerProfiles
=
(
profiles
=
scannerProfiles
)
=>
({
data
:
{
project
:
{
scannerProfiles
:
{
...
defaults
,
edges
:
profiles
.
map
(
profile
=>
({
cursor
:
''
,
node
:
profile
,
})),
},
},
},
});
export
const
dastSiteProfiles
=
(
profiles
=
siteProfiles
)
=>
({
data
:
{
project
:
{
siteProfiles
:
{
...
defaults
,
edges
:
profiles
.
map
(
profile
=>
({
cursor
:
''
,
node
:
profile
,
})),
},
},
},
});
ee/spec/frontend/security_configuration/dast_scanner_profiles_form/components/dast_scanner_profiles_form_spec.js
View file @
7ef723e5
...
...
@@ -6,7 +6,7 @@ import DastScannerProfileForm from 'ee/security_configuration/dast_scanner_profi
import
{
SCAN_TYPE
}
from
'
ee/security_configuration/dast_scanner_profiles/constants
'
;
import
dastScannerProfileCreateMutation
from
'
ee/security_configuration/dast_scanner_profiles/graphql/dast_scanner_profile_create.mutation.graphql
'
;
import
dastScannerProfileUpdateMutation
from
'
ee/security_configuration/dast_scanner_profiles/graphql/dast_scanner_profile_update.mutation.graphql
'
;
import
{
scannerProfiles
}
from
'
ee_jest/on_demand_scans/mock
s/mock
_data
'
;
import
{
scannerProfiles
}
from
'
ee_jest/on_demand_scans/mock_data
'
;
import
{
TEST_HOST
}
from
'
helpers/test_constants
'
;
import
{
redirectTo
}
from
'
~/lib/utils/url_utility
'
;
...
...
ee/spec/frontend/security_configuration/dast_site_profiles_form/components/dast_site_profile_form_spec.js
View file @
7ef723e5
...
...
@@ -7,7 +7,7 @@ import VueApollo from 'vue-apollo';
import
DastSiteProfileForm
from
'
ee/security_configuration/dast_site_profiles_form/components/dast_site_profile_form.vue
'
;
import
dastSiteProfileCreateMutation
from
'
ee/security_configuration/dast_site_profiles_form/graphql/dast_site_profile_create.mutation.graphql
'
;
import
dastSiteProfileUpdateMutation
from
'
ee/security_configuration/dast_site_profiles_form/graphql/dast_site_profile_update.mutation.graphql
'
;
import
{
siteProfiles
}
from
'
ee_jest/on_demand_scans/mock
s/mock
_data
'
;
import
{
siteProfiles
}
from
'
ee_jest/on_demand_scans/mock_data
'
;
import
*
as
responses
from
'
ee_jest/security_configuration/dast_site_profiles_form/mock_data/apollo_mock
'
;
import
{
TEST_HOST
}
from
'
helpers/test_constants
'
;
import
waitForPromises
from
'
jest/helpers/wait_for_promises
'
;
...
...
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