Commit 636c81c0 authored by Victor Zagorodny's avatar Victor Zagorodny

Simplify API tests

parent e77bd057
...@@ -33,9 +33,6 @@ describe API::Vulnerabilities do ...@@ -33,9 +33,6 @@ describe API::Vulnerabilities do
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(200)
expect(json_response.map { |v| v['id'] }).to contain_exactly(project.vulnerabilities.second.id) expect(json_response.map { |v| v['id'] }).to contain_exactly(project.vulnerabilities.second.id)
end end
end
it_behaves_like 'forbids access to vulnerability-like endpoint in expected cases'
context 'when "first-class vulnerabilities" feature is disabled' do context 'when "first-class vulnerabilities" feature is disabled' do
before do before do
...@@ -45,4 +42,7 @@ describe API::Vulnerabilities do ...@@ -45,4 +42,7 @@ describe API::Vulnerabilities do
it_behaves_like 'getting list of vulnerability findings' it_behaves_like 'getting list of vulnerability findings'
end end
end end
it_behaves_like 'forbids access to vulnerability-like endpoint in expected cases'
end
end end
...@@ -10,6 +10,12 @@ describe API::VulnerabilityFindings do ...@@ -10,6 +10,12 @@ describe API::VulnerabilityFindings do
let(:project_vulnerabilities_path) { "/projects/#{project.id}/vulnerability_findings" } let(:project_vulnerabilities_path) { "/projects/#{project.id}/vulnerability_findings" }
it_behaves_like 'getting list of vulnerability findings' it_behaves_like 'getting list of vulnerability findings'
it_behaves_like 'forbids access to vulnerability-like endpoint in expected cases'
context 'with an authorized user with proper permissions' do
before do
project.add_developer(user)
end
context 'when "first-class vulnerabilities" feature is disabled' do context 'when "first-class vulnerabilities" feature is disabled' do
before do before do
...@@ -23,4 +29,5 @@ describe API::VulnerabilityFindings do ...@@ -23,4 +29,5 @@ describe API::VulnerabilityFindings do
end end
end end
end end
end
end end
...@@ -217,6 +217,4 @@ shared_examples 'getting list of vulnerability findings' do ...@@ -217,6 +217,4 @@ shared_examples 'getting list of vulnerability findings' do
end end
end end
end end
it_behaves_like 'forbids access to vulnerability-like endpoint in expected cases'
end end
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