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
0816d293
Commit
0816d293
authored
Feb 16, 2018
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds pipelines script to the security tab
Adds tests for new security app & mediator
parent
87bcf5ca
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
0 deletions
+70
-0
app/assets/javascripts/dispatcher.js
app/assets/javascripts/dispatcher.js
+1
-0
spec/javascripts/pipelines/pipeline_details_mediator_spec.js
spec/javascripts/pipelines/pipeline_details_mediator_spec.js
+26
-0
spec/javascripts/pipelines/security_reports/security_report_app_spec.js
...ts/pipelines/security_reports/security_report_app_spec.js
+43
-0
No files found.
app/assets/javascripts/dispatcher.js
View file @
0816d293
...
...
@@ -320,6 +320,7 @@ var Dispatcher;
break
;
case
'
projects:pipelines:builds
'
:
case
'
projects:pipelines:failures
'
:
case
'
projects:pipelines:security
'
:
case
'
projects:pipelines:show
'
:
import
(
'
./pages/projects/pipelines/builds
'
)
.
then
(
callDefault
)
...
...
spec/javascripts/pipelines/pipeline_details_mediator_spec.js
View file @
0816d293
import
_
from
'
underscore
'
;
import
Vue
from
'
vue
'
;
import
PipelineMediator
from
'
~/pipelines/pipeline_details_mediator
'
;
import
{
sastIssues
,
parsedSastIssuesStore
}
from
'
../vue_shared/security_reports/mock_data
'
;
describe
(
'
PipelineMdediator
'
,
()
=>
{
let
mediator
;
...
...
@@ -39,4 +40,29 @@ describe('PipelineMdediator', () => {
});
});
});
describe
(
'
security reports
'
,
()
=>
{
const
interceptor
=
(
request
,
next
)
=>
{
next
(
request
.
respondWith
(
JSON
.
stringify
(
sastIssues
),
{
status
:
200
,
}));
};
beforeEach
(()
=>
{
Vue
.
http
.
interceptors
.
push
(
interceptor
);
});
afterEach
(()
=>
{
Vue
.
http
.
interceptors
=
_
.
without
(
Vue
.
http
.
interceptor
,
interceptor
);
});
it
(
'
fetches the requests endpoint and stores the data
'
,
(
done
)
=>
{
mediator
.
fetchSastReport
(
'
sast.json
'
,
'
path
'
);
setTimeout
(()
=>
{
expect
(
mediator
.
store
.
state
.
securityReports
.
sast
.
newIssues
).
toEqual
(
parsedSastIssuesStore
);
done
();
},
0
);
});
});
});
spec/javascripts/pipelines/security_reports/security_report_app_spec.js
0 → 100644
View file @
0816d293
import
Vue
from
'
vue
'
;
import
securityReportApp
from
'
~/pipelines/components/security_reports/security_report_app.vue
'
;
import
mountComponent
from
'
../../helpers/vue_mount_component_helper
'
;
import
{
parsedSastIssuesHead
}
from
'
../../vue_shared/security_reports/mock_data
'
;
describe
(
'
Security Report App
'
,
()
=>
{
let
vm
;
let
Component
;
beforeEach
(()
=>
{
Component
=
Vue
.
extend
(
securityReportApp
);
});
afterEach
(()
=>
{
vm
.
$destroy
();
});
describe
(
'
sast report
'
,
()
=>
{
beforeEach
(()
=>
{
vm
=
mountComponent
(
Component
,
{
securityReports
:
{
sast
:
{
isLoading
:
false
,
hasError
:
false
,
newIssues
:
parsedSastIssuesHead
,
resolvedIssues
:
[],
allIssues
:
[],
},
},
});
});
it
(
'
renders the sast report
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-code-text
'
).
textContent
.
trim
()).
toEqual
(
'
SAST degraded on 2 security vulnerabilities
'
);
expect
(
vm
.
$el
.
querySelectorAll
(
'
.js-mr-code-new-issues li
'
).
length
).
toEqual
(
parsedSastIssuesHead
.
length
);
const
issue
=
vm
.
$el
.
querySelector
(
'
.js-mr-code-new-issues li
'
).
textContent
;
expect
(
issue
).
toContain
(
parsedSastIssuesHead
[
0
].
message
);
expect
(
issue
).
toContain
(
parsedSastIssuesHead
[
0
].
path
);
});
});
});
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