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
636c81c0
Commit
636c81c0
authored
Oct 10, 2019
by
Victor Zagorodny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify API tests
parent
e77bd057
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
14 deletions
+19
-14
ee/spec/requests/api/vulnerabilities_spec.rb
ee/spec/requests/api/vulnerabilities_spec.rb
+7
-7
ee/spec/requests/api/vulnerability_findings_spec.rb
ee/spec/requests/api/vulnerability_findings_spec.rb
+12
-5
ee/spec/support/shared_examples/requests/api/vulnerabilities_shared_examples.rb
..._examples/requests/api/vulnerabilities_shared_examples.rb
+0
-2
No files found.
ee/spec/requests/api/vulnerabilities_spec.rb
View file @
636c81c0
...
...
@@ -33,16 +33,16 @@ describe API::Vulnerabilities do
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
.
map
{
|
v
|
v
[
'id'
]
}).
to
contain_exactly
(
project
.
vulnerabilities
.
second
.
id
)
end
end
it_behaves_like
'forbids access to vulnerability-like endpoint in expected cases'
context
'when "first-class vulnerabilities" feature is disabled'
do
before
do
stub_feature_flags
(
first_class_vulnerabilities:
false
)
end
context
'when "first-class vulnerabilities" feature is disabled'
do
before
do
stub_feature_flags
(
first_class_vulnerabilities:
false
)
it_behaves_like
'getting list of vulnerability findings'
end
it_behaves_like
'getting list of vulnerability findings'
end
it_behaves_like
'forbids access to vulnerability-like endpoint in expected cases'
end
end
ee/spec/requests/api/vulnerability_findings_spec.rb
View file @
636c81c0
...
...
@@ -10,16 +10,23 @@ describe API::VulnerabilityFindings do
let
(
:project_vulnerabilities_path
)
{
"/projects/
#{
project
.
id
}
/vulnerability_findings"
}
it_behaves_like
'getting list of vulnerability findings'
it_behaves_like
'forbids access to vulnerability-like endpoint in expected cases'
context
'w
hen "first-class vulnerabilities" feature is disabled
'
do
context
'w
ith an authorized user with proper permissions
'
do
before
do
stub_feature_flags
(
first_class_vulnerabilities:
false
)
project
.
add_developer
(
user
)
end
it
'responds with "not found"'
do
get
api
(
project_vulnerabilities_path
,
user
)
context
'when "first-class vulnerabilities" feature is disabled'
do
before
do
stub_feature_flags
(
first_class_vulnerabilities:
false
)
end
expect
(
response
).
to
have_gitlab_http_status
(
404
)
it
'responds with "not found"'
do
get
api
(
project_vulnerabilities_path
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
end
end
end
end
...
...
ee/spec/support/shared_examples/requests/api/vulnerabilities_shared_examples.rb
View file @
636c81c0
...
...
@@ -217,6 +217,4 @@ shared_examples 'getting list of vulnerability findings' do
end
end
end
it_behaves_like
'forbids access to vulnerability-like endpoint in expected cases'
end
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