Commit fbb3a6ce authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch '196719-rename-sast-container-to-container-scanning' into 'master'

Frontend: Rename Sast Container to Container Scanning

See merge request gitlab-org/gitlab!23814
parents e8c92405 9d9afa0b
...@@ -3,7 +3,7 @@ import CodequalityIssueBody from 'ee/vue_merge_request_widget/components/codequa ...@@ -3,7 +3,7 @@ import CodequalityIssueBody from 'ee/vue_merge_request_widget/components/codequa
import BlockingMergeRequestsBody from 'ee/vue_merge_request_widget/components/blocking_merge_requests/blocking_merge_request_body.vue'; import BlockingMergeRequestsBody from 'ee/vue_merge_request_widget/components/blocking_merge_requests/blocking_merge_request_body.vue';
import LicenseIssueBody from 'ee/vue_shared/license_management/components/license_issue_body.vue'; import LicenseIssueBody from 'ee/vue_shared/license_management/components/license_issue_body.vue';
import SastIssueBody from 'ee/vue_shared/security_reports/components/sast_issue_body.vue'; import SastIssueBody from 'ee/vue_shared/security_reports/components/sast_issue_body.vue';
import SastContainerIssueBody from 'ee/vue_shared/security_reports/components/sast_container_issue_body.vue'; import ContainerScanningIssueBody from 'ee/vue_shared/security_reports/components/container_scanning_issue_body.vue';
import DastIssueBody from 'ee/vue_shared/security_reports/components/dast_issue_body.vue'; import DastIssueBody from 'ee/vue_shared/security_reports/components/dast_issue_body.vue';
import MetricsReportsIssueBody from 'ee/vue_shared/metrics_reports/components/metrics_reports_issue_body.vue'; import MetricsReportsIssueBody from 'ee/vue_shared/metrics_reports/components/metrics_reports_issue_body.vue';
import { import {
...@@ -16,7 +16,7 @@ export const components = { ...@@ -16,7 +16,7 @@ export const components = {
PerformanceIssueBody, PerformanceIssueBody,
CodequalityIssueBody, CodequalityIssueBody,
LicenseIssueBody, LicenseIssueBody,
SastContainerIssueBody, ContainerScanningIssueBody,
SastIssueBody, SastIssueBody,
DastIssueBody, DastIssueBody,
MetricsReportsIssueBody, MetricsReportsIssueBody,
...@@ -28,7 +28,7 @@ export const componentNames = { ...@@ -28,7 +28,7 @@ export const componentNames = {
PerformanceIssueBody: PerformanceIssueBody.name, PerformanceIssueBody: PerformanceIssueBody.name,
CodequalityIssueBody: CodequalityIssueBody.name, CodequalityIssueBody: CodequalityIssueBody.name,
LicenseIssueBody: LicenseIssueBody.name, LicenseIssueBody: LicenseIssueBody.name,
SastContainerIssueBody: SastContainerIssueBody.name, ContainerScanningIssueBody: ContainerScanningIssueBody.name,
SastIssueBody: SastIssueBody.name, SastIssueBody: SastIssueBody.name,
DastIssueBody: DastIssueBody.name, DastIssueBody: DastIssueBody.name,
MetricsReportsIssueBody: MetricsReportsIssueBody.name, MetricsReportsIssueBody: MetricsReportsIssueBody.name,
......
...@@ -304,7 +304,7 @@ export default { ...@@ -304,7 +304,7 @@ export default {
:enabled-reports="mr.enabledSecurityReports" :enabled-reports="mr.enabledSecurityReports"
:sast-help-path="mr.sastHelp" :sast-help-path="mr.sastHelp"
:dast-help-path="mr.dastHelp" :dast-help-path="mr.dastHelp"
:sast-container-help-path="mr.sastContainerHelp" :container-scanning-help-path="mr.containerScanningHelp"
:dependency-scanning-help-path="mr.dependencyScanningHelp" :dependency-scanning-help-path="mr.dependencyScanningHelp"
:vulnerability-feedback-path="mr.vulnerabilityFeedbackPath" :vulnerability-feedback-path="mr.vulnerabilityFeedbackPath"
:vulnerability-feedback-help-path="mr.vulnerabilityFeedbackHelpPath" :vulnerability-feedback-help-path="mr.vulnerabilityFeedbackHelpPath"
......
...@@ -11,7 +11,7 @@ export default class MergeRequestStore extends CEMergeRequestStore { ...@@ -11,7 +11,7 @@ export default class MergeRequestStore extends CEMergeRequestStore {
this.headBlobPath = blobPath.head_path || ''; this.headBlobPath = blobPath.head_path || '';
this.baseBlobPath = blobPath.base_path || ''; this.baseBlobPath = blobPath.base_path || '';
this.sastHelp = data.sast_help_path; this.sastHelp = data.sast_help_path;
this.sastContainerHelp = data.sast_container_help_path; this.containerScanningHelp = data.container_scanning_help_path;
this.dastHelp = data.dast_help_path; this.dastHelp = data.dast_help_path;
this.dependencyScanningHelp = data.dependency_scanning_help_path; this.dependencyScanningHelp = data.dependency_scanning_help_path;
this.vulnerabilityFeedbackPath = data.vulnerability_feedback_path; this.vulnerabilityFeedbackPath = data.vulnerability_feedback_path;
......
<script> <script>
/** /**
* Renders SAST CONTAINER body text * Renders CONTAINER SCANNING body text
* [priority]: [name] in [link]:[line] * [priority]: [name] in [link]:[line]
*/ */
import ModalOpenName from '~/reports/components/modal_open_name.vue'; import ModalOpenName from '~/reports/components/modal_open_name.vue';
import { humanize } from '~/lib/utils/text_utility'; import { humanize } from '~/lib/utils/text_utility';
export default { export default {
name: 'SastContainerIssueBody', name: 'ContainerScanningIssueBody',
components: { components: {
ModalOpenName, ModalOpenName,
}, },
......
...@@ -51,7 +51,7 @@ export default { ...@@ -51,7 +51,7 @@ export default {
required: false, required: false,
default: '', default: '',
}, },
sastContainerHelpPath: { containerScanningHelpPath: {
type: String, type: String,
required: false, required: false,
default: '', default: '',
...@@ -118,7 +118,7 @@ export default { ...@@ -118,7 +118,7 @@ export default {
computed: { computed: {
...mapState([ ...mapState([
'sast', 'sast',
'sastContainer', 'containerScanning',
'dast', 'dast',
'dependencyScanning', 'dependencyScanning',
'summaryCounts', 'summaryCounts',
...@@ -129,10 +129,10 @@ export default { ...@@ -129,10 +129,10 @@ export default {
...mapGetters([ ...mapGetters([
'groupedSummaryText', 'groupedSummaryText',
'summaryStatus', 'summaryStatus',
'groupedSastContainerText', 'groupedContainerScanningText',
'groupedDastText', 'groupedDastText',
'groupedDependencyText', 'groupedDependencyText',
'sastContainerStatusIcon', 'containerScanningStatusIcon',
'dastStatusIcon', 'dastStatusIcon',
'dependencyScanningStatusIcon', 'dependencyScanningStatusIcon',
'isBaseSecurityReportOutOfDate', 'isBaseSecurityReportOutOfDate',
...@@ -203,8 +203,8 @@ export default { ...@@ -203,8 +203,8 @@ export default {
const containerScanningDiffEndpoint = gl?.mrWidgetData?.container_scanning_comparison_path; const containerScanningDiffEndpoint = gl?.mrWidgetData?.container_scanning_comparison_path;
if (containerScanningDiffEndpoint && this.hasContainerScanningReports) { if (containerScanningDiffEndpoint && this.hasContainerScanningReports) {
this.setSastContainerDiffEndpoint(containerScanningDiffEndpoint); this.setContainerScanningDiffEndpoint(containerScanningDiffEndpoint);
this.fetchSastContainerDiff(); this.fetchContainerScanningDiff();
} }
// eslint-disable-next-line camelcase // eslint-disable-next-line camelcase
...@@ -248,8 +248,8 @@ export default { ...@@ -248,8 +248,8 @@ export default {
'deleteDismissalComment', 'deleteDismissalComment',
'showDismissalDeleteButtons', 'showDismissalDeleteButtons',
'hideDismissalDeleteButtons', 'hideDismissalDeleteButtons',
'fetchSastContainerDiff', 'fetchContainerScanningDiff',
'setSastContainerDiffEndpoint', 'setContainerScanningDiffEndpoint',
'fetchDependencyScanningDiff', 'fetchDependencyScanningDiff',
'setDependencyScanningDiffEndpoint', 'setDependencyScanningDiffEndpoint',
'fetchDastDiff', 'fetchDastDiff',
...@@ -327,18 +327,18 @@ export default { ...@@ -327,18 +327,18 @@ export default {
<template v-if="hasContainerScanningReports"> <template v-if="hasContainerScanningReports">
<summary-row <summary-row
:summary="groupedSastContainerText" :summary="groupedContainerScanningText"
:status-icon="sastContainerStatusIcon" :status-icon="containerScanningStatusIcon"
:popover-options="sastContainerPopover" :popover-options="containerScanningPopover"
class="js-sast-container" class="js-container-scanning"
data-qa-selector="container_scan_report" data-qa-selector="container_scan_report"
/> />
<issues-list <issues-list
v-if="sastContainer.newIssues.length || sastContainer.resolvedIssues.length" v-if="containerScanning.newIssues.length || containerScanning.resolvedIssues.length"
:unresolved-issues="sastContainer.newIssues" :unresolved-issues="containerScanning.newIssues"
:resolved-issues="sastContainer.resolvedIssues" :resolved-issues="containerScanning.resolvedIssues"
:component="$options.componentNames.SastContainerIssueBody" :component="$options.componentNames.ContainerScanningIssueBody"
class="report-block-group-list" class="report-block-group-list"
/> />
</template> </template>
......
...@@ -25,7 +25,7 @@ export default { ...@@ -25,7 +25,7 @@ export default {
), ),
}; };
}, },
sastContainerPopover() { containerScanningPopover() {
return { return {
title: s__( title: s__(
'ciReport|Container scanning detects known vulnerabilities in your docker images.', 'ciReport|Container scanning detects known vulnerabilities in your docker images.',
...@@ -33,7 +33,7 @@ export default { ...@@ -33,7 +33,7 @@ export default {
content: sprintf( content: sprintf(
s__('ciReport|%{linkStartTag}Learn more about Container Scanning %{linkEndTag}'), s__('ciReport|%{linkStartTag}Learn more about Container Scanning %{linkEndTag}'),
{ {
linkStartTag: getLinkStartTag(this.sastContainerHelpPath), linkStartTag: getLinkStartTag(this.containerScanningHelpPath),
linkEndTag, linkEndTag,
}, },
false, false,
......
...@@ -48,26 +48,26 @@ export const setCanCreateFeedbackPermission = ({ commit }, permission) => ...@@ -48,26 +48,26 @@ export const setCanCreateFeedbackPermission = ({ commit }, permission) =>
commit(types.SET_CAN_CREATE_FEEDBACK_PERMISSION, permission); commit(types.SET_CAN_CREATE_FEEDBACK_PERMISSION, permission);
/** /**
* SAST CONTAINER * CONTAINER SCANNING
*/ */
export const setSastContainerDiffEndpoint = ({ commit }, path) => export const setContainerScanningDiffEndpoint = ({ commit }, path) =>
commit(types.SET_SAST_CONTAINER_DIFF_ENDPOINT, path); commit(types.SET_CONTAINER_SCANNING_DIFF_ENDPOINT, path);
export const requestSastContainerReports = ({ commit }) => export const requestContainerScanningDiff = ({ commit }) =>
commit(types.REQUEST_SAST_CONTAINER_REPORTS); commit(types.REQUEST_CONTAINER_SCANNING_DIFF);
export const receiveSastContainerDiffSuccess = ({ commit }, response) => export const receiveContainerScanningDiffSuccess = ({ commit }, response) =>
commit(types.RECEIVE_SAST_CONTAINER_DIFF_SUCCESS, response); commit(types.RECEIVE_CONTAINER_SCANNING_DIFF_SUCCESS, response);
export const receiveSastContainerDiffError = ({ commit }) => export const receiveContainerScanningDiffError = ({ commit }) =>
commit(types.RECEIVE_SAST_CONTAINER_DIFF_ERROR); commit(types.RECEIVE_CONTAINER_SCANNING_DIFF_ERROR);
export const fetchSastContainerDiff = ({ state, dispatch }) => { export const fetchContainerScanningDiff = ({ state, dispatch }) => {
dispatch('requestSastContainerReports'); dispatch('requestContainerScanningDiff');
return Promise.all([ return Promise.all([
pollUntilComplete(state.sastContainer.paths.diffEndpoint), pollUntilComplete(state.containerScanning.paths.diffEndpoint),
axios.get(state.vulnerabilityFeedbackPath, { axios.get(state.vulnerabilityFeedbackPath, {
params: { params: {
category: 'container_scanning', category: 'container_scanning',
...@@ -75,13 +75,13 @@ export const fetchSastContainerDiff = ({ state, dispatch }) => { ...@@ -75,13 +75,13 @@ export const fetchSastContainerDiff = ({ state, dispatch }) => {
}), }),
]) ])
.then(values => { .then(values => {
dispatch('receiveSastContainerDiffSuccess', { dispatch('receiveContainerScanningDiffSuccess', {
diff: values[0].data, diff: values[0].data,
enrichData: values[1].data, enrichData: values[1].data,
}); });
}) })
.catch(() => { .catch(() => {
dispatch('receiveSastContainerDiffError'); dispatch('receiveContainerScanningDiffError');
}); });
}; };
......
...@@ -3,9 +3,9 @@ import { countIssues, groupedTextBuilder, statusIcon, groupedReportText } from ' ...@@ -3,9 +3,9 @@ import { countIssues, groupedTextBuilder, statusIcon, groupedReportText } from '
import { LOADING, ERROR, SUCCESS } from './constants'; import { LOADING, ERROR, SUCCESS } from './constants';
import messages from './messages'; import messages from './messages';
export const groupedSastContainerText = ({ sastContainer }) => export const groupedContainerScanningText = ({ containerScanning }) =>
groupedReportText( groupedReportText(
sastContainer, containerScanning,
messages.CONTAINER_SCANNING, messages.CONTAINER_SCANNING,
messages.CONTAINER_SCANNING_HAS_ERROR, messages.CONTAINER_SCANNING_HAS_ERROR,
messages.CONTAINER_SCANNING_IS_LOADING, messages.CONTAINER_SCANNING_IS_LOADING,
...@@ -23,7 +23,7 @@ export const groupedDependencyText = ({ dependencyScanning }) => ...@@ -23,7 +23,7 @@ export const groupedDependencyText = ({ dependencyScanning }) =>
); );
export const summaryCounts = state => export const summaryCounts = state =>
[state.sast, state.sastContainer, state.dast, state.dependencyScanning].reduce( [state.sast, state.containerScanning, state.dast, state.dependencyScanning].reduce(
(acc, report) => { (acc, report) => {
const curr = countIssues(report); const curr = countIssues(report);
acc.added += curr.added; acc.added += curr.added;
...@@ -81,8 +81,12 @@ export const summaryStatus = (state, getters) => { ...@@ -81,8 +81,12 @@ export const summaryStatus = (state, getters) => {
return SUCCESS; return SUCCESS;
}; };
export const sastContainerStatusIcon = ({ sastContainer }) => export const containerScanningStatusIcon = ({ containerScanning }) =>
statusIcon(sastContainer.isLoading, sastContainer.hasError, sastContainer.newIssues.length); statusIcon(
containerScanning.isLoading,
containerScanning.hasError,
containerScanning.newIssues.length,
);
export const dastStatusIcon = ({ dast }) => export const dastStatusIcon = ({ dast }) =>
statusIcon(dast.isLoading, dast.hasError, dast.newIssues.length); statusIcon(dast.isLoading, dast.hasError, dast.newIssues.length);
...@@ -97,43 +101,43 @@ export const dependencyScanningStatusIcon = ({ dependencyScanning }) => ...@@ -97,43 +101,43 @@ export const dependencyScanningStatusIcon = ({ dependencyScanning }) =>
export const areReportsLoading = state => export const areReportsLoading = state =>
state.sast.isLoading || state.sast.isLoading ||
state.dast.isLoading || state.dast.isLoading ||
state.sastContainer.isLoading || state.containerScanning.isLoading ||
state.dependencyScanning.isLoading; state.dependencyScanning.isLoading;
export const areAllReportsLoading = state => export const areAllReportsLoading = state =>
state.sast.isLoading && state.sast.isLoading &&
state.dast.isLoading && state.dast.isLoading &&
state.sastContainer.isLoading && state.containerScanning.isLoading &&
state.dependencyScanning.isLoading; state.dependencyScanning.isLoading;
export const allReportsHaveError = state => export const allReportsHaveError = state =>
state.sast.hasError && state.sast.hasError &&
state.dast.hasError && state.dast.hasError &&
state.sastContainer.hasError && state.containerScanning.hasError &&
state.dependencyScanning.hasError; state.dependencyScanning.hasError;
export const anyReportHasError = state => export const anyReportHasError = state =>
state.sast.hasError || state.sast.hasError ||
state.dast.hasError || state.dast.hasError ||
state.sastContainer.hasError || state.containerScanning.hasError ||
state.dependencyScanning.hasError; state.dependencyScanning.hasError;
export const noBaseInAllReports = state => export const noBaseInAllReports = state =>
!state.sast.hasBaseReport && !state.sast.hasBaseReport &&
!state.dast.hasBaseReport && !state.dast.hasBaseReport &&
!state.sastContainer.hasBaseReport && !state.containerScanning.hasBaseReport &&
!state.dependencyScanning.hasBaseReport; !state.dependencyScanning.hasBaseReport;
export const anyReportHasIssues = state => export const anyReportHasIssues = state =>
state.sast.newIssues.length > 0 || state.sast.newIssues.length > 0 ||
state.dast.newIssues.length > 0 || state.dast.newIssues.length > 0 ||
state.sastContainer.newIssues.length > 0 || state.containerScanning.newIssues.length > 0 ||
state.dependencyScanning.newIssues.length > 0; state.dependencyScanning.newIssues.length > 0;
export const isBaseSecurityReportOutOfDate = state => export const isBaseSecurityReportOutOfDate = state =>
state.sast.baseReportOutofDate || state.sast.baseReportOutofDate ||
state.dast.baseReportOutofDate || state.dast.baseReportOutofDate ||
state.sastContainer.baseReportOutofDate || state.containerScanning.baseReportOutofDate ||
state.dependencyScanning.baseReportOutofDate; state.dependencyScanning.baseReportOutofDate;
// prevent babel-plugin-rewire from generating an invalid default during karma tests // prevent babel-plugin-rewire from generating an invalid default during karma tests
......
...@@ -13,11 +13,11 @@ export const SET_PIPELINE_ID = 'SET_PIPELINE_ID'; ...@@ -13,11 +13,11 @@ export const SET_PIPELINE_ID = 'SET_PIPELINE_ID';
export const SET_CAN_CREATE_ISSUE_PERMISSION = 'SET_CAN_CREATE_ISSUE_PERMISSION'; export const SET_CAN_CREATE_ISSUE_PERMISSION = 'SET_CAN_CREATE_ISSUE_PERMISSION';
export const SET_CAN_CREATE_FEEDBACK_PERMISSION = 'SET_CAN_CREATE_FEEDBACK_PERMISSION'; export const SET_CAN_CREATE_FEEDBACK_PERMISSION = 'SET_CAN_CREATE_FEEDBACK_PERMISSION';
// SAST CONTAINER // CONTAINER SCANNING
export const SET_SAST_CONTAINER_DIFF_ENDPOINT = 'SET_SAST_CONTAINER_DIFF_ENDPOINT'; export const SET_CONTAINER_SCANNING_DIFF_ENDPOINT = 'SET_CONTAINER_SCANNING_DIFF_ENDPOINT';
export const REQUEST_SAST_CONTAINER_REPORTS = 'REQUEST_SAST_CONTAINER_REPORTS'; export const REQUEST_CONTAINER_SCANNING_DIFF = 'REQUEST_CONTAINER_SCANNING_DIFF';
export const RECEIVE_SAST_CONTAINER_DIFF_SUCCESS = 'RECEIVE_SAST_CONTAINER_DIFF_SUCCESS'; export const RECEIVE_CONTAINER_SCANNING_DIFF_SUCCESS = 'RECEIVE_CONTAINER_SCANNING_DIFF_SUCCESS';
export const RECEIVE_SAST_CONTAINER_DIFF_ERROR = 'RECEIVE_SAST_CONTAINER_DIFF_ERROR'; export const RECEIVE_CONTAINER_SCANNING_DIFF_ERROR = 'RECEIVE_CONTAINER_SCANNING_DIFF_ERROR';
// DAST // DAST
export const SET_DAST_DIFF_ENDPOINT = 'SET_DAST_DIFF_ENDPOINT'; export const SET_DAST_DIFF_ENDPOINT = 'SET_DAST_DIFF_ENDPOINT';
......
...@@ -49,31 +49,31 @@ export default { ...@@ -49,31 +49,31 @@ export default {
state.canCreateFeedbackPermission = permission; state.canCreateFeedbackPermission = permission;
}, },
// SAST CONTAINER // CONTAINER SCANNING
[types.SET_SAST_CONTAINER_DIFF_ENDPOINT](state, path) { [types.SET_CONTAINER_SCANNING_DIFF_ENDPOINT](state, path) {
Vue.set(state.sastContainer.paths, 'diffEndpoint', path); Vue.set(state.containerScanning.paths, 'diffEndpoint', path);
}, },
[types.REQUEST_SAST_CONTAINER_REPORTS](state) { [types.REQUEST_CONTAINER_SCANNING_DIFF](state) {
Vue.set(state.sastContainer, 'isLoading', true); Vue.set(state.containerScanning, 'isLoading', true);
}, },
[types.RECEIVE_SAST_CONTAINER_DIFF_SUCCESS](state, { diff, enrichData }) { [types.RECEIVE_CONTAINER_SCANNING_DIFF_SUCCESS](state, { diff, enrichData }) {
const { added, fixed, existing } = parseDiff(diff, enrichData); const { added, fixed, existing } = parseDiff(diff, enrichData);
const baseReportOutofDate = diff.base_report_out_of_date || false; const baseReportOutofDate = diff.base_report_out_of_date || false;
const hasBaseReport = Boolean(diff.base_report_created_at); const hasBaseReport = Boolean(diff.base_report_created_at);
Vue.set(state.sastContainer, 'isLoading', false); Vue.set(state.containerScanning, 'isLoading', false);
Vue.set(state.sastContainer, 'newIssues', added); Vue.set(state.containerScanning, 'newIssues', added);
Vue.set(state.sastContainer, 'resolvedIssues', fixed); Vue.set(state.containerScanning, 'resolvedIssues', fixed);
Vue.set(state.sastContainer, 'allIssues', existing); Vue.set(state.containerScanning, 'allIssues', existing);
Vue.set(state.sastContainer, 'baseReportOutofDate', baseReportOutofDate); Vue.set(state.containerScanning, 'baseReportOutofDate', baseReportOutofDate);
Vue.set(state.sastContainer, 'hasBaseReport', hasBaseReport); Vue.set(state.containerScanning, 'hasBaseReport', hasBaseReport);
}, },
[types.RECEIVE_SAST_CONTAINER_DIFF_ERROR](state) { [types.RECEIVE_CONTAINER_SCANNING_DIFF_ERROR](state) {
Vue.set(state.sastContainer, 'isLoading', false); Vue.set(state.containerScanning, 'isLoading', false);
Vue.set(state.sastContainer, 'hasError', true); Vue.set(state.containerScanning, 'hasError', true);
}, },
// DAST // DAST
...@@ -251,15 +251,15 @@ export default { ...@@ -251,15 +251,15 @@ export default {
[types.UPDATE_CONTAINER_SCANNING_ISSUE](state, issue) { [types.UPDATE_CONTAINER_SCANNING_ISSUE](state, issue) {
// Find issue in the correct list and update it // Find issue in the correct list and update it
const newIssuesIndex = findIssueIndex(state.sastContainer.newIssues, issue); const newIssuesIndex = findIssueIndex(state.containerScanning.newIssues, issue);
if (newIssuesIndex !== -1) { if (newIssuesIndex !== -1) {
state.sastContainer.newIssues.splice(newIssuesIndex, 1, issue); state.containerScanning.newIssues.splice(newIssuesIndex, 1, issue);
return; return;
} }
const resolvedIssuesIndex = findIssueIndex(state.sastContainer.resolvedIssues, issue); const resolvedIssuesIndex = findIssueIndex(state.containerScanning.resolvedIssues, issue);
if (resolvedIssuesIndex !== -1) { if (resolvedIssuesIndex !== -1) {
state.sastContainer.resolvedIssues.splice(resolvedIssuesIndex, 1, issue); state.containerScanning.resolvedIssues.splice(resolvedIssuesIndex, 1, issue);
} }
}, },
......
...@@ -16,7 +16,7 @@ export default () => ({ ...@@ -16,7 +16,7 @@ export default () => ({
canCreateIssuePermission: false, canCreateIssuePermission: false,
canCreateFeedbackPermission: false, canCreateFeedbackPermission: false,
sastContainer: { containerScanning: {
paths: { paths: {
head: null, head: null,
base: null, base: null,
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
window.gl.mrWidgetData.is_geo_secondary_node = '#{Gitlab::Geo.secondary?}' === 'true'; window.gl.mrWidgetData.is_geo_secondary_node = '#{Gitlab::Geo.secondary?}' === 'true';
window.gl.mrWidgetData.geo_secondary_help_path = '#{help_page_path("administration/geo/replication/configuration.md")}'; window.gl.mrWidgetData.geo_secondary_help_path = '#{help_page_path("administration/geo/replication/configuration.md")}';
window.gl.mrWidgetData.sast_help_path = '#{help_page_path("user/application_security/sast/index")}'; window.gl.mrWidgetData.sast_help_path = '#{help_page_path("user/application_security/sast/index")}';
window.gl.mrWidgetData.sast_container_help_path = '#{help_page_path("user/application_security/container_scanning/index")}'; window.gl.mrWidgetData.container_scanning_help_path = '#{help_page_path("user/application_security/container_scanning/index")}';
window.gl.mrWidgetData.dast_help_path = '#{help_page_path("user/application_security/dast/index")}'; window.gl.mrWidgetData.dast_help_path = '#{help_page_path("user/application_security/dast/index")}';
window.gl.mrWidgetData.dependency_scanning_help_path = '#{help_page_path("user/application_security/dependency_scanning/index")}'; window.gl.mrWidgetData.dependency_scanning_help_path = '#{help_page_path("user/application_security/dependency_scanning/index")}';
window.gl.mrWidgetData.vulnerability_feedback_help_path = '#{help_page_path("user/application_security/index")}'; window.gl.mrWidgetData.vulnerability_feedback_help_path = '#{help_page_path("user/application_security/index")}';
......
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Sast Container Issue Body matches snapshot 1`] = ` exports[`Container Scanning Issue Body matches snapshot 1`] = `
<div <div
class="report-block-list-issue-description prepend-top-5 append-bottom-5" class="report-block-list-issue-description prepend-top-5 append-bottom-5"
> >
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import SastContainerIssueBody from 'ee/vue_shared/security_reports/components/sast_container_issue_body.vue'; import ContainerScanningIssueBody from 'ee/vue_shared/security_reports/components/container_scanning_issue_body.vue';
describe('Sast Container Issue Body', () => { describe('Container Scanning Issue Body', () => {
let wrapper; let wrapper;
const createComponent = severity => { const createComponent = severity => {
wrapper = shallowMount(SastContainerIssueBody, { wrapper = shallowMount(ContainerScanningIssueBody, {
propsData: { propsData: {
issue: { issue: {
title: 'CVE-2017-11671', title: 'CVE-2017-11671',
......
...@@ -31,7 +31,7 @@ describe('Grouped security reports app', () => { ...@@ -31,7 +31,7 @@ describe('Grouped security reports app', () => {
headBlobPath: 'path', headBlobPath: 'path',
baseBlobPath: 'path', baseBlobPath: 'path',
sastHelpPath: 'path', sastHelpPath: 'path',
sastContainerHelpPath: 'path', containerScanningHelpPath: 'path',
dastHelpPath: 'path', dastHelpPath: 'path',
dependencyScanningHelpPath: 'path', dependencyScanningHelpPath: 'path',
vulnerabilityFeedbackPath: 'vulnerability_feedback_path.json', vulnerabilityFeedbackPath: 'vulnerability_feedback_path.json',
...@@ -93,7 +93,7 @@ describe('Grouped security reports app', () => { ...@@ -93,7 +93,7 @@ describe('Grouped security reports app', () => {
return Promise.all([ return Promise.all([
waitForMutation(wrapper.vm.$store, `sast/${sastTypes.RECEIVE_DIFF_ERROR}`), waitForMutation(wrapper.vm.$store, `sast/${sastTypes.RECEIVE_DIFF_ERROR}`),
waitForMutation(wrapper.vm.$store, types.RECEIVE_SAST_CONTAINER_DIFF_ERROR), waitForMutation(wrapper.vm.$store, types.RECEIVE_CONTAINER_SCANNING_DIFF_ERROR),
waitForMutation(wrapper.vm.$store, types.RECEIVE_DAST_DIFF_ERROR), waitForMutation(wrapper.vm.$store, types.RECEIVE_DAST_DIFF_ERROR),
waitForMutation(wrapper.vm.$store, types.RECEIVE_DEPENDENCY_SCANNING_DIFF_ERROR), waitForMutation(wrapper.vm.$store, types.RECEIVE_DEPENDENCY_SCANNING_DIFF_ERROR),
]); ]);
...@@ -164,7 +164,7 @@ describe('Grouped security reports app', () => { ...@@ -164,7 +164,7 @@ describe('Grouped security reports app', () => {
return Promise.all([ return Promise.all([
waitForMutation(wrapper.vm.$store, `sast/${sastTypes.RECEIVE_DIFF_SUCCESS}`), waitForMutation(wrapper.vm.$store, `sast/${sastTypes.RECEIVE_DIFF_SUCCESS}`),
waitForMutation(wrapper.vm.$store, types.RECEIVE_DAST_DIFF_SUCCESS), waitForMutation(wrapper.vm.$store, types.RECEIVE_DAST_DIFF_SUCCESS),
waitForMutation(wrapper.vm.$store, types.RECEIVE_SAST_CONTAINER_DIFF_SUCCESS), waitForMutation(wrapper.vm.$store, types.RECEIVE_CONTAINER_SCANNING_DIFF_SUCCESS),
waitForMutation(wrapper.vm.$store, types.RECEIVE_DEPENDENCY_SCANNING_DIFF_SUCCESS), waitForMutation(wrapper.vm.$store, types.RECEIVE_DEPENDENCY_SCANNING_DIFF_SUCCESS),
]); ]);
}); });
...@@ -220,7 +220,7 @@ describe('Grouped security reports app', () => { ...@@ -220,7 +220,7 @@ describe('Grouped security reports app', () => {
it('has the success icon for fixed vulnerabilities', () => { it('has the success icon for fixed vulnerabilities', () => {
const icon = wrapper.vm.$el.querySelector( const icon = wrapper.vm.$el.querySelector(
'.js-sast-container~.js-plain-element .ic-status_success_borderless', '.js-container-scanning~.js-plain-element .ic-status_success_borderless',
); );
expect(icon).not.toBeNull(); expect(icon).not.toBeNull();
...@@ -260,11 +260,13 @@ describe('Grouped security reports app', () => { ...@@ -260,11 +260,13 @@ describe('Grouped security reports app', () => {
}, },
}); });
return waitForMutation(wrapper.vm.$store, types.RECEIVE_SAST_CONTAINER_DIFF_SUCCESS); return waitForMutation(wrapper.vm.$store, types.RECEIVE_CONTAINER_SCANNING_DIFF_SUCCESS);
}); });
it('should set setSastContainerDiffEndpoint', () => { it('should set setContainerScanningDiffEndpoint', () => {
expect(wrapper.vm.sastContainer.paths.diffEndpoint).toEqual(CONTAINER_SCANNING_DIFF_ENDPOINT); expect(wrapper.vm.containerScanning.paths.diffEndpoint).toEqual(
CONTAINER_SCANNING_DIFF_ENDPOINT,
);
}); });
it('should display the correct numbers of vulnerabilities', () => { it('should display the correct numbers of vulnerabilities', () => {
......
...@@ -5,7 +5,7 @@ describe('securityReportMixin', () => { ...@@ -5,7 +5,7 @@ describe('securityReportMixin', () => {
it.each` it.each`
key | link key | link
${'sast'} | ${'http://fake.url/sast/help/path'} ${'sast'} | ${'http://fake.url/sast/help/path'}
${'sastContainer'} | ${'http://fake.url/sast/container/help/path'} ${'containerScanning'} | ${'http://fake.url/container/scanning/help/path'}
${'dast'} | ${'http://fake.url/dast/help/path'} ${'dast'} | ${'http://fake.url/dast/help/path'}
${'dependencyScanning'} | ${'http://fake.url/dependency/scanning/help/path'} ${'dependencyScanning'} | ${'http://fake.url/dependency/scanning/help/path'}
`('generates correct external link with icon', ({ key, link }) => { `('generates correct external link with icon', ({ key, link }) => {
......
...@@ -7,7 +7,7 @@ import { ...@@ -7,7 +7,7 @@ import {
setPipelineId, setPipelineId,
setCanCreateIssuePermission, setCanCreateIssuePermission,
setCanCreateFeedbackPermission, setCanCreateFeedbackPermission,
requestSastContainerReports, requestContainerScanningDiff,
requestDastDiff, requestDastDiff,
requestDependencyScanningDiff, requestDependencyScanningDiff,
openModal, openModal,
...@@ -39,10 +39,10 @@ import { ...@@ -39,10 +39,10 @@ import {
requestDeleteDismissalComment, requestDeleteDismissalComment,
showDismissalDeleteButtons, showDismissalDeleteButtons,
hideDismissalDeleteButtons, hideDismissalDeleteButtons,
setSastContainerDiffEndpoint, setContainerScanningDiffEndpoint,
receiveSastContainerDiffSuccess, receiveContainerScanningDiffSuccess,
receiveSastContainerDiffError, receiveContainerScanningDiffError,
fetchSastContainerDiff, fetchContainerScanningDiff,
setDependencyScanningDiffEndpoint, setDependencyScanningDiffEndpoint,
receiveDependencyScanningDiffSuccess, receiveDependencyScanningDiffSuccess,
receiveDependencyScanningDiffError, receiveDependencyScanningDiffError,
...@@ -230,15 +230,15 @@ describe('security reports actions', () => { ...@@ -230,15 +230,15 @@ describe('security reports actions', () => {
}); });
}); });
describe('requestSastContainerReports', () => { describe('requestContainerScanningDiff', () => {
it('should commit request mutation', done => { it('should commit request mutation', done => {
testAction( testAction(
requestSastContainerReports, requestContainerScanningDiff,
null, null,
mockedState, mockedState,
[ [
{ {
type: types.REQUEST_SAST_CONTAINER_REPORTS, type: types.REQUEST_CONTAINER_SCANNING_DIFF,
}, },
], ],
[], [],
...@@ -1087,17 +1087,17 @@ describe('security reports actions', () => { ...@@ -1087,17 +1087,17 @@ describe('security reports actions', () => {
}); });
}); });
describe('setSastContainerDiffEndpoint', () => { describe('setContainerScanningDiffEndpoint', () => {
it('should pass down the endpoint to the mutation', done => { it('should pass down the endpoint to the mutation', done => {
const payload = '/sast_container_endpoint.json'; const payload = '/container_scanning_endpoint.json';
testAction( testAction(
setSastContainerDiffEndpoint, setContainerScanningDiffEndpoint,
payload, payload,
mockedState, mockedState,
[ [
{ {
type: types.SET_SAST_CONTAINER_DIFF_ENDPOINT, type: types.SET_CONTAINER_SCANNING_DIFF_ENDPOINT,
payload, payload,
}, },
], ],
...@@ -1107,17 +1107,17 @@ describe('security reports actions', () => { ...@@ -1107,17 +1107,17 @@ describe('security reports actions', () => {
}); });
}); });
describe('receiveSastContainerDiffSuccess', () => { describe('receiveContainerScanningDiffSuccess', () => {
it('should pass down the response to the mutation', done => { it('should pass down the response to the mutation', done => {
const payload = { data: 'Effort yields its own rewards.' }; const payload = { data: 'Effort yields its own rewards.' };
testAction( testAction(
receiveSastContainerDiffSuccess, receiveContainerScanningDiffSuccess,
payload, payload,
mockedState, mockedState,
[ [
{ {
type: types.RECEIVE_SAST_CONTAINER_DIFF_SUCCESS, type: types.RECEIVE_CONTAINER_SCANNING_DIFF_SUCCESS,
payload, payload,
}, },
], ],
...@@ -1127,15 +1127,15 @@ describe('security reports actions', () => { ...@@ -1127,15 +1127,15 @@ describe('security reports actions', () => {
}); });
}); });
describe('receiveSastContainerDiffError', () => { describe('receiveContainerScanningDiffError', () => {
it('should commit container diff error mutation', done => { it('should commit container diff error mutation', done => {
testAction( testAction(
receiveSastContainerDiffError, receiveContainerScanningDiffError,
undefined, undefined,
mockedState, mockedState,
[ [
{ {
type: types.RECEIVE_SAST_CONTAINER_DIFF_ERROR, type: types.RECEIVE_CONTAINER_SCANNING_DIFF_ERROR,
}, },
], ],
[], [],
...@@ -1144,17 +1144,18 @@ describe('security reports actions', () => { ...@@ -1144,17 +1144,18 @@ describe('security reports actions', () => {
}); });
}); });
describe('fetchSastContainerDiff', () => { describe('fetchContainerScanningDiff', () => {
const diff = { vulnerabilities: [] }; const diff = { vulnerabilities: [] };
const endpoint = 'container_scanning_diff.json';
beforeEach(() => { beforeEach(() => {
mockedState.vulnerabilityFeedbackPath = 'vulnerabilities_feedback'; mockedState.vulnerabilityFeedbackPath = 'vulnerabilities_feedback';
mockedState.sastContainer.paths.diffEndpoint = 'sast_container_diff.json'; mockedState.containerScanning.paths.diffEndpoint = endpoint;
}); });
describe('on success', () => { describe('on success', () => {
it('should dispatch `receiveSastContainerDiffSuccess`', done => { it('should dispatch `receiveContainerScanningDiffSuccess`', done => {
mock.onGet('sast_container_diff.json').reply(200, diff); mock.onGet(endpoint).reply(200, diff);
mock mock
.onGet('vulnerabilities_feedback', { .onGet('vulnerabilities_feedback', {
params: { params: {
...@@ -1164,16 +1165,16 @@ describe('security reports actions', () => { ...@@ -1164,16 +1165,16 @@ describe('security reports actions', () => {
.reply(200, containerScanningFeedbacks); .reply(200, containerScanningFeedbacks);
testAction( testAction(
fetchSastContainerDiff, fetchContainerScanningDiff,
null, null,
mockedState, mockedState,
[], [],
[ [
{ {
type: 'requestSastContainerReports', type: 'requestContainerScanningDiff',
}, },
{ {
type: 'receiveSastContainerDiffSuccess', type: 'receiveContainerScanningDiffSuccess',
payload: { payload: {
diff, diff,
enrichData: containerScanningFeedbacks, enrichData: containerScanningFeedbacks,
...@@ -1186,8 +1187,8 @@ describe('security reports actions', () => { ...@@ -1186,8 +1187,8 @@ describe('security reports actions', () => {
}); });
describe('when vulnerabilities path errors', () => { describe('when vulnerabilities path errors', () => {
it('should dispatch `receiveSastContainerError`', done => { it('should dispatch `receiveContainerScanningError`', done => {
mock.onGet('sast_container_diff.json').reply(500); mock.onGet(endpoint).reply(500);
mock mock
.onGet('vulnerabilities_feedback', { .onGet('vulnerabilities_feedback', {
params: { params: {
...@@ -1197,16 +1198,16 @@ describe('security reports actions', () => { ...@@ -1197,16 +1198,16 @@ describe('security reports actions', () => {
.reply(200, containerScanningFeedbacks); .reply(200, containerScanningFeedbacks);
testAction( testAction(
fetchSastContainerDiff, fetchContainerScanningDiff,
null, null,
mockedState, mockedState,
[], [],
[ [
{ {
type: 'requestSastContainerReports', type: 'requestContainerScanningDiff',
}, },
{ {
type: 'receiveSastContainerDiffError', type: 'receiveContainerScanningDiffError',
}, },
], ],
done, done,
...@@ -1215,8 +1216,8 @@ describe('security reports actions', () => { ...@@ -1215,8 +1216,8 @@ describe('security reports actions', () => {
}); });
describe('when feedback path errors', () => { describe('when feedback path errors', () => {
it('should dispatch `receiveSastContainerError`', done => { it('should dispatch `receiveContainerScanningError`', done => {
mock.onGet('sast_container_diff.json').reply(200, diff); mock.onGet(endpoint).reply(200, diff);
mock mock
.onGet('vulnerabilities_feedback', { .onGet('vulnerabilities_feedback', {
params: { params: {
...@@ -1226,16 +1227,16 @@ describe('security reports actions', () => { ...@@ -1226,16 +1227,16 @@ describe('security reports actions', () => {
.reply(500); .reply(500);
testAction( testAction(
fetchSastContainerDiff, fetchContainerScanningDiff,
null, null,
mockedState, mockedState,
[], [],
[ [
{ {
type: 'requestSastContainerReports', type: 'requestContainerScanningDiff',
}, },
{ {
type: 'receiveSastContainerDiffError', type: 'receiveContainerScanningDiffError',
}, },
], ],
done, done,
......
import createState from 'ee/vue_shared/security_reports/store/state'; import createState from 'ee/vue_shared/security_reports/store/state';
import createSastState from 'ee/vue_shared/security_reports/store/modules/sast/state'; import createSastState from 'ee/vue_shared/security_reports/store/modules/sast/state';
import { import {
groupedSastContainerText, groupedContainerScanningText,
groupedDastText, groupedDastText,
groupedDependencyText, groupedDependencyText,
groupedSummaryText, groupedSummaryText,
allReportsHaveError, allReportsHaveError,
noBaseInAllReports, noBaseInAllReports,
areReportsLoading, areReportsLoading,
sastContainerStatusIcon, containerScanningStatusIcon,
dastStatusIcon, dastStatusIcon,
dependencyScanningStatusIcon, dependencyScanningStatusIcon,
anyReportHasError, anyReportHasError,
...@@ -31,13 +31,13 @@ describe('Security reports getters', () => { ...@@ -31,13 +31,13 @@ describe('Security reports getters', () => {
state.sast = createSastState(); state.sast = createSastState();
}); });
describe('groupedSastContainerText', () => { describe('groupedContainerScanningText', () => {
describe('with no issues', () => { describe('with no issues', () => {
it('returns no issues text', () => { it('returns no issues text', () => {
state.sastContainer.paths.head = HEAD_PATH; state.containerScanning.paths.head = HEAD_PATH;
state.sastContainer.paths.base = BASE_PATH; state.containerScanning.paths.base = BASE_PATH;
expect(groupedSastContainerText(state)).toEqual( expect(groupedContainerScanningText(state)).toEqual(
'Container scanning detected no vulnerabilities', 'Container scanning detected no vulnerabilities',
); );
}); });
...@@ -45,10 +45,10 @@ describe('Security reports getters', () => { ...@@ -45,10 +45,10 @@ describe('Security reports getters', () => {
describe('with new issues and without base', () => { describe('with new issues and without base', () => {
it('returns unable to compare text', () => { it('returns unable to compare text', () => {
state.sastContainer.paths.head = HEAD_PATH; state.containerScanning.paths.head = HEAD_PATH;
state.sastContainer.newIssues = [{}]; state.containerScanning.newIssues = [{}];
expect(groupedSastContainerText(state)).toEqual( expect(groupedContainerScanningText(state)).toEqual(
'Container scanning detected 1 vulnerability for the source branch only', 'Container scanning detected 1 vulnerability for the source branch only',
); );
}); });
...@@ -57,11 +57,11 @@ describe('Security reports getters', () => { ...@@ -57,11 +57,11 @@ describe('Security reports getters', () => {
describe('with base and head', () => { describe('with base and head', () => {
describe('with only new issues', () => { describe('with only new issues', () => {
it('returns new issues text', () => { it('returns new issues text', () => {
state.sastContainer.paths.head = HEAD_PATH; state.containerScanning.paths.head = HEAD_PATH;
state.sastContainer.paths.base = BASE_PATH; state.containerScanning.paths.base = BASE_PATH;
state.sastContainer.newIssues = [{}]; state.containerScanning.newIssues = [{}];
expect(groupedSastContainerText(state)).toEqual( expect(groupedContainerScanningText(state)).toEqual(
'Container scanning detected 1 new vulnerability', 'Container scanning detected 1 new vulnerability',
); );
}); });
...@@ -69,11 +69,11 @@ describe('Security reports getters', () => { ...@@ -69,11 +69,11 @@ describe('Security reports getters', () => {
describe('with only dismissed issues', () => { describe('with only dismissed issues', () => {
it('returns dismissed issues text', () => { it('returns dismissed issues text', () => {
state.sastContainer.paths.head = HEAD_PATH; state.containerScanning.paths.head = HEAD_PATH;
state.sastContainer.paths.base = BASE_PATH; state.containerScanning.paths.base = BASE_PATH;
state.sastContainer.newIssues = [{ isDismissed: true }]; state.containerScanning.newIssues = [{ isDismissed: true }];
expect(groupedSastContainerText(state)).toEqual( expect(groupedContainerScanningText(state)).toEqual(
'Container scanning detected 1 dismissed vulnerability', 'Container scanning detected 1 dismissed vulnerability',
); );
}); });
...@@ -81,12 +81,12 @@ describe('Security reports getters', () => { ...@@ -81,12 +81,12 @@ describe('Security reports getters', () => {
describe('with new and resolved issues', () => { describe('with new and resolved issues', () => {
it('returns new and fixed issues text', () => { it('returns new and fixed issues text', () => {
state.sastContainer.paths.head = HEAD_PATH; state.containerScanning.paths.head = HEAD_PATH;
state.sastContainer.paths.base = BASE_PATH; state.containerScanning.paths.base = BASE_PATH;
state.sastContainer.newIssues = [{}]; state.containerScanning.newIssues = [{}];
state.sastContainer.resolvedIssues = [{}]; state.containerScanning.resolvedIssues = [{}];
expect(removeBreakLine(groupedSastContainerText(state))).toEqual( expect(removeBreakLine(groupedContainerScanningText(state))).toEqual(
'Container scanning detected 1 new, and 1 fixed vulnerabilities', 'Container scanning detected 1 new, and 1 fixed vulnerabilities',
); );
}); });
...@@ -94,11 +94,11 @@ describe('Security reports getters', () => { ...@@ -94,11 +94,11 @@ describe('Security reports getters', () => {
describe('with only resolved issues', () => { describe('with only resolved issues', () => {
it('returns fixed issues text', () => { it('returns fixed issues text', () => {
state.sastContainer.paths.head = HEAD_PATH; state.containerScanning.paths.head = HEAD_PATH;
state.sastContainer.paths.base = BASE_PATH; state.containerScanning.paths.base = BASE_PATH;
state.sastContainer.resolvedIssues = [{}]; state.containerScanning.resolvedIssues = [{}];
expect(groupedSastContainerText(state)).toEqual( expect(groupedContainerScanningText(state)).toEqual(
'Container scanning detected 1 fixed vulnerability', 'Container scanning detected 1 fixed vulnerability',
); );
}); });
...@@ -261,7 +261,7 @@ describe('Security reports getters', () => { ...@@ -261,7 +261,7 @@ describe('Security reports getters', () => {
describe('combines all reports', () => { describe('combines all reports', () => {
it('of the same type', () => { it('of the same type', () => {
state.sastContainer.resolvedIssues = [{}]; state.containerScanning.resolvedIssues = [{}];
state.dast.resolvedIssues = [{}]; state.dast.resolvedIssues = [{}];
state.dependencyScanning.resolvedIssues = [{}]; state.dependencyScanning.resolvedIssues = [{}];
...@@ -274,7 +274,7 @@ describe('Security reports getters', () => { ...@@ -274,7 +274,7 @@ describe('Security reports getters', () => {
}); });
it('of the different types', () => { it('of the different types', () => {
state.sastContainer.resolvedIssues = [{}]; state.containerScanning.resolvedIssues = [{}];
state.dast.allIssues = [{}]; state.dast.allIssues = [{}];
state.dast.newIssues = [{ isDismissed: true }]; state.dast.newIssues = [{ isDismissed: true }];
state.dependencyScanning.newIssues = [{ isDismissed: false }]; state.dependencyScanning.newIssues = [{ isDismissed: false }];
...@@ -437,21 +437,21 @@ describe('Security reports getters', () => { ...@@ -437,21 +437,21 @@ describe('Security reports getters', () => {
}); });
}); });
describe('sastContainerStatusIcon', () => { describe('containerScanningStatusIcon', () => {
it('returns warning with new issues', () => { it('returns warning with new issues', () => {
state.sastContainer.newIssues = [{}]; state.containerScanning.newIssues = [{}];
expect(sastContainerStatusIcon(state)).toEqual('warning'); expect(containerScanningStatusIcon(state)).toEqual('warning');
}); });
it('returns warning with failed report', () => { it('returns warning with failed report', () => {
state.sastContainer.hasError = true; state.containerScanning.hasError = true;
expect(sastContainerStatusIcon(state)).toEqual('warning'); expect(containerScanningStatusIcon(state)).toEqual('warning');
}); });
it('returns success with no new issues or failed report', () => { it('returns success with no new issues or failed report', () => {
expect(sastContainerStatusIcon(state)).toEqual('success'); expect(containerScanningStatusIcon(state)).toEqual('success');
}); });
}); });
...@@ -489,7 +489,7 @@ describe('Security reports getters', () => { ...@@ -489,7 +489,7 @@ describe('Security reports getters', () => {
it('returns true when all reports have error', () => { it('returns true when all reports have error', () => {
state.sast.hasError = true; state.sast.hasError = true;
state.dast.hasError = true; state.dast.hasError = true;
state.sastContainer.hasError = true; state.containerScanning.hasError = true;
state.dependencyScanning.hasError = true; state.dependencyScanning.hasError = true;
expect(allReportsHaveError(state)).toEqual(true); expect(allReportsHaveError(state)).toEqual(true);
...@@ -501,7 +501,7 @@ describe('Security reports getters', () => { ...@@ -501,7 +501,7 @@ describe('Security reports getters', () => {
it('returns false when one of the reports does not have error', () => { it('returns false when one of the reports does not have error', () => {
state.dast.hasError = false; state.dast.hasError = false;
state.sastContainer.hasError = true; state.containerScanning.hasError = true;
state.dependencyScanning.hasError = true; state.dependencyScanning.hasError = true;
expect(allReportsHaveError(state)).toEqual(false); expect(allReportsHaveError(state)).toEqual(false);
......
...@@ -71,11 +71,11 @@ describe('security reports mutations', () => { ...@@ -71,11 +71,11 @@ describe('security reports mutations', () => {
}); });
}); });
describe('REQUEST_SAST_CONTAINER_REPORTS', () => { describe('REQUEST_CONTAINER_SCANNING_DIFF', () => {
it('should set sast container loading flag to true', () => { it('should set container scanning loading flag to true', () => {
mutations[types.REQUEST_SAST_CONTAINER_REPORTS](stateCopy); mutations[types.REQUEST_CONTAINER_SCANNING_DIFF](stateCopy);
expect(stateCopy.sastContainer.isLoading).toEqual(true); expect(stateCopy.containerScanning.isLoading).toEqual(true);
}); });
}); });
...@@ -516,8 +516,8 @@ describe('security reports mutations', () => { ...@@ -516,8 +516,8 @@ describe('security reports mutations', () => {
describe('UPDATE_CONTAINER_SCANNING_ISSUE', () => { describe('UPDATE_CONTAINER_SCANNING_ISSUE', () => {
it('updates issue in the new issues list', () => { it('updates issue in the new issues list', () => {
stateCopy.sastContainer.newIssues = mockFindings; stateCopy.containerScanning.newIssues = mockFindings;
stateCopy.sastContainer.resolvedIssues = []; stateCopy.containerScanning.resolvedIssues = [];
const updatedIssue = { const updatedIssue = {
...mockFindings[0], ...mockFindings[0],
foo: 'bar', foo: 'bar',
...@@ -525,12 +525,12 @@ describe('security reports mutations', () => { ...@@ -525,12 +525,12 @@ describe('security reports mutations', () => {
mutations[types.UPDATE_CONTAINER_SCANNING_ISSUE](stateCopy, updatedIssue); mutations[types.UPDATE_CONTAINER_SCANNING_ISSUE](stateCopy, updatedIssue);
expect(stateCopy.sastContainer.newIssues[0]).toEqual(updatedIssue); expect(stateCopy.containerScanning.newIssues[0]).toEqual(updatedIssue);
}); });
it('updates issue in the resolved issues list', () => { it('updates issue in the resolved issues list', () => {
stateCopy.sastContainer.newIssues = []; stateCopy.containerScanning.newIssues = [];
stateCopy.sastContainer.resolvedIssues = mockFindings; stateCopy.containerScanning.resolvedIssues = mockFindings;
const updatedIssue = { const updatedIssue = {
...mockFindings[0], ...mockFindings[0],
foo: 'bar', foo: 'bar',
...@@ -538,7 +538,7 @@ describe('security reports mutations', () => { ...@@ -538,7 +538,7 @@ describe('security reports mutations', () => {
mutations[types.UPDATE_CONTAINER_SCANNING_ISSUE](stateCopy, updatedIssue); mutations[types.UPDATE_CONTAINER_SCANNING_ISSUE](stateCopy, updatedIssue);
expect(stateCopy.sastContainer.resolvedIssues[0]).toEqual(updatedIssue); expect(stateCopy.containerScanning.resolvedIssues[0]).toEqual(updatedIssue);
}); });
}); });
...@@ -570,19 +570,19 @@ describe('security reports mutations', () => { ...@@ -570,19 +570,19 @@ describe('security reports mutations', () => {
}); });
}); });
describe('SET_SAST_CONTAINER_DIFF_ENDPOINT', () => { describe('SET_CONTAINER_SCANNING_DIFF_ENDPOINT', () => {
const endpoint = 'sast_container_diff_endpoint.json'; const endpoint = 'container_scanning_diff_endpoint.json';
beforeEach(() => { beforeEach(() => {
mutations[types.SET_SAST_CONTAINER_DIFF_ENDPOINT](stateCopy, endpoint); mutations[types.SET_CONTAINER_SCANNING_DIFF_ENDPOINT](stateCopy, endpoint);
}); });
it('should set the correct endpoint', () => { it('should set the correct endpoint', () => {
expect(stateCopy.sastContainer.paths.diffEndpoint).toEqual(endpoint); expect(stateCopy.containerScanning.paths.diffEndpoint).toEqual(endpoint);
}); });
}); });
describe('RECEIVE_SAST_CONTAINER_DIFF_SUCCESS', () => { describe('RECEIVE_CONTAINER_SCANNING_DIFF_SUCCESS', () => {
const reports = { const reports = {
diff: { diff: {
added: [ added: [
...@@ -595,20 +595,20 @@ describe('security reports mutations', () => { ...@@ -595,20 +595,20 @@ describe('security reports mutations', () => {
}; };
beforeEach(() => { beforeEach(() => {
mutations[types.RECEIVE_SAST_CONTAINER_DIFF_SUCCESS](stateCopy, reports); mutations[types.RECEIVE_CONTAINER_SCANNING_DIFF_SUCCESS](stateCopy, reports);
}); });
it('should set isLoading to false', () => { it('should set isLoading to false', () => {
expect(stateCopy.sastContainer.isLoading).toBe(false); expect(stateCopy.containerScanning.isLoading).toBe(false);
}); });
it('should set baseReportOutofDate to true', () => { it('should set baseReportOutofDate to true', () => {
expect(stateCopy.sastContainer.baseReportOutofDate).toBe(true); expect(stateCopy.containerScanning.baseReportOutofDate).toBe(true);
}); });
it('should parse and set the added vulnerabilities', () => { it('should parse and set the added vulnerabilities', () => {
reports.diff.added.forEach((vuln, i) => { reports.diff.added.forEach((vuln, i) => {
expect(stateCopy.sastContainer.newIssues[i]).toEqual( expect(stateCopy.containerScanning.newIssues[i]).toEqual(
expect.objectContaining({ expect.objectContaining({
name: vuln.name, name: vuln.name,
title: vuln.name, title: vuln.name,
...@@ -620,7 +620,7 @@ describe('security reports mutations', () => { ...@@ -620,7 +620,7 @@ describe('security reports mutations', () => {
it('should parse and set the fixed vulnerabilities', () => { it('should parse and set the fixed vulnerabilities', () => {
reports.diff.fixed.forEach((vuln, i) => { reports.diff.fixed.forEach((vuln, i) => {
expect(stateCopy.sastContainer.resolvedIssues[i]).toEqual( expect(stateCopy.containerScanning.resolvedIssues[i]).toEqual(
expect.objectContaining({ expect.objectContaining({
name: vuln.name, name: vuln.name,
title: vuln.name, title: vuln.name,
...@@ -631,12 +631,12 @@ describe('security reports mutations', () => { ...@@ -631,12 +631,12 @@ describe('security reports mutations', () => {
}); });
}); });
describe('RECEIVE_SAST_CONTAINER_DIFF_ERROR', () => { describe('RECEIVE_CONTAINER_SCANNING_DIFF_ERROR', () => {
it('should set sast container loading flag to false and error flag to true', () => { it('should set container scanning loading flag to false and error flag to true', () => {
mutations[types.RECEIVE_SAST_CONTAINER_DIFF_ERROR](stateCopy); mutations[types.RECEIVE_CONTAINER_SCANNING_DIFF_ERROR](stateCopy);
expect(stateCopy.sastContainer.isLoading).toEqual(false); expect(stateCopy.containerScanning.isLoading).toEqual(false);
expect(stateCopy.sastContainer.hasError).toEqual(true); expect(stateCopy.containerScanning.hasError).toEqual(true);
}); });
}); });
......
...@@ -29,7 +29,7 @@ import { ...@@ -29,7 +29,7 @@ import {
const SAST_SELECTOR = '.js-sast-widget'; const SAST_SELECTOR = '.js-sast-widget';
const DAST_SELECTOR = '.js-dast-widget'; const DAST_SELECTOR = '.js-dast-widget';
const DEPENDENCY_SCANNING_SELECTOR = '.js-dependency-scanning-widget'; const DEPENDENCY_SCANNING_SELECTOR = '.js-dependency-scanning-widget';
const CONTAINER_SCANNING_SELECTOR = '.js-sast-container'; const CONTAINER_SCANNING_SELECTOR = '.js-container-scanning';
describe('ee merge request widget options', () => { describe('ee merge request widget options', () => {
let vm; let vm;
......
...@@ -90,7 +90,7 @@ describe('Report issues', () => { ...@@ -90,7 +90,7 @@ describe('Report issues', () => {
beforeEach(() => { beforeEach(() => {
vm = mountComponent(ReportIssues, { vm = mountComponent(ReportIssues, {
issue: dockerReportParsed.unapproved[0], issue: dockerReportParsed.unapproved[0],
component: componentNames.SastContainerIssueBody, component: componentNames.ContainerScanningIssueBody,
status: STATUS_FAILED, status: STATUS_FAILED,
}); });
}); });
......
...@@ -90,7 +90,7 @@ describe('Report issue', () => { ...@@ -90,7 +90,7 @@ describe('Report issue', () => {
beforeEach(() => { beforeEach(() => {
vm = mountComponent(ReportIssue, { vm = mountComponent(ReportIssue, {
issue: dockerReportParsed.unapproved[0], issue: dockerReportParsed.unapproved[0],
component: componentNames.SastContainerIssueBody, component: componentNames.ContainerScanningIssueBody,
status: STATUS_FAILED, status: STATUS_FAILED,
}); });
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment