Commit 20cf2dea authored by Tetiana Chupryna's avatar Tetiana Chupryna

Update relevant tests

parent b8438780
...@@ -698,33 +698,6 @@ describe Projects::MergeRequestsController do ...@@ -698,33 +698,6 @@ describe Projects::MergeRequestsController do
it_behaves_like 'authorize read pipeline' it_behaves_like 'authorize read pipeline'
end end
describe 'GET #license_management_reports' do
let(:merge_request) { create(:ee_merge_request, :with_license_scanning_reports, source_project: project, author: create(:user)) }
let(:comparison_status) { { status: :parsed, data: { new_licenses: [], existing_licenses: [], removed_licenses: [] } } }
let(:params) do
{
namespace_id: project.namespace.to_param,
project_id: project,
id: merge_request.iid
}
end
subject { get :license_management_reports, params: params, format: :json }
before do
allow_any_instance_of(::MergeRequest).to receive(:compare_reports)
.with(::Ci::CompareLicenseScanningReportsService, project.users.first).and_return(comparison_status)
end
it 'returns 200 HTTP status' do
subject
expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to eq({ "new_licenses" => [], "existing_licenses" => [], "removed_licenses" => [] })
end
end
describe 'GET #license_scanning_reports' do describe 'GET #license_scanning_reports' do
let(:merge_request) { create(:ee_merge_request, :with_license_scanning_reports, source_project: project, author: create(:user)) } let(:merge_request) { create(:ee_merge_request, :with_license_scanning_reports, source_project: project, author: create(:user)) }
......
...@@ -115,9 +115,9 @@ describe MergeRequest do ...@@ -115,9 +115,9 @@ describe MergeRequest do
:container_scanning | :with_container_scanning_reports | :container_scanning :container_scanning | :with_container_scanning_reports | :container_scanning
:dast | :with_dast_reports | :dast :dast | :with_dast_reports | :dast
:dependency_scanning | :with_dependency_scanning_reports | :dependency_scanning :dependency_scanning | :with_dependency_scanning_reports | :dependency_scanning
:license_management | :with_license_management_reports | :license_management :license_management | :with_license_management_reports | :license_scanning
:license_management | :with_license_scanning_reports | :license_management :license_management | :with_license_scanning_reports | :license_scanning
:license_scanning | :with_license_scanning_reports | :license_management :license_scanning | :with_license_scanning_reports | :license_scanning
end end
with_them do with_them do
...@@ -162,22 +162,22 @@ describe MergeRequest do ...@@ -162,22 +162,22 @@ describe MergeRequest do
end end
end end
describe '#has_license_management_reports?' do describe '#has_license_scanning_reports?' do
subject { merge_request.has_license_management_reports? } subject { merge_request.has_license_scanning_reports? }
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
before do before do
stub_licensed_features(license_management: true) stub_licensed_features(license_scanning: true)
end end
context 'when head pipeline has license management reports' do context 'when head pipeline has license scanning reports' do
let(:merge_request) { create(:ee_merge_request, :with_license_management_reports, source_project: project) } let(:merge_request) { create(:ee_merge_request, :with_license_scanning_reports, source_project: project) }
it { is_expected.to be_truthy } it { is_expected.to be_truthy }
end end
context 'when head pipeline does not have license management reports' do context 'when head pipeline does not have license scanning reports' do
let(:merge_request) { create(:ee_merge_request, source_project: project) } let(:merge_request) { create(:ee_merge_request, source_project: project) }
it { is_expected.to be_falsey } it { is_expected.to be_falsey }
...@@ -439,8 +439,8 @@ describe MergeRequest do ...@@ -439,8 +439,8 @@ describe MergeRequest do
end end
end end
describe '#compare_license_management_reports' do describe '#compare_license_scanning_reports' do
subject { merge_request.compare_license_management_reports(current_user) } subject { merge_request.compare_license_scanning_reports(current_user) }
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
let(:current_user) { project.users.first } let(:current_user) { project.users.first }
...@@ -448,7 +448,7 @@ describe MergeRequest do ...@@ -448,7 +448,7 @@ describe MergeRequest do
let!(:base_pipeline) do let!(:base_pipeline) do
create(:ee_ci_pipeline, create(:ee_ci_pipeline,
:with_license_management_report, :with_license_scanning_report,
project: project, project: project,
ref: merge_request.target_branch, ref: merge_request.target_branch,
sha: merge_request.diff_base_sha) sha: merge_request.diff_base_sha)
...@@ -458,10 +458,10 @@ describe MergeRequest do ...@@ -458,10 +458,10 @@ describe MergeRequest do
merge_request.update!(head_pipeline_id: head_pipeline.id) merge_request.update!(head_pipeline_id: head_pipeline.id)
end end
context 'when head pipeline has license management reports' do context 'when head pipeline has license scanning reports' do
let!(:head_pipeline) do let!(:head_pipeline) do
create(:ee_ci_pipeline, create(:ee_ci_pipeline,
:with_license_management_report, :with_license_scanning_report,
project: project, project: project,
ref: merge_request.source_branch, ref: merge_request.source_branch,
sha: merge_request.diff_head_sha) sha: merge_request.diff_head_sha)
...@@ -510,7 +510,7 @@ describe MergeRequest do ...@@ -510,7 +510,7 @@ describe MergeRequest do
end end
end end
context 'when head pipeline does not have license management reports' do context 'when head pipeline does not have license scanning reports' do
let!(:head_pipeline) do let!(:head_pipeline) do
create(:ci_pipeline, create(:ci_pipeline,
project: project, project: project,
...@@ -520,7 +520,7 @@ describe MergeRequest do ...@@ -520,7 +520,7 @@ describe MergeRequest do
it 'returns status and error message' do it 'returns status and error message' do
expect(subject[:status]).to eq(:error) expect(subject[:status]).to eq(:error)
expect(subject[:status_reason]).to eq('This merge request does not have license management reports') expect(subject[:status_reason]).to eq('This merge request does not have license scanning reports')
end end
end end
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