Commit aad0df7e authored by Robert Speicher's avatar Robert Speicher

Merge branch '5943_improve_license_management_tests' into 'master'

5943 improve license management tests

Closes #5943

See merge request gitlab-org/gitlab-ee!5718
parents b40594d5 b7a58d83
......@@ -16,8 +16,10 @@ describe MergeRequestWidgetEntity do
end
it 'has blob path data' do
allow(merge_request).to receive(:base_pipeline).and_return(pipeline)
allow(merge_request).to receive(:head_pipeline).and_return(pipeline)
allow(merge_request).to receive_messages(
base_pipeline: pipeline,
head_pipeline: pipeline
)
expect(subject.as_json).to include(:blob_path)
expect(subject.as_json[:blob_path]).to include(:base_path)
......@@ -27,9 +29,11 @@ describe MergeRequestWidgetEntity do
it 'has performance data' do
build = create(:ci_build, name: 'job')
allow(merge_request).to receive(:expose_performance_data?).and_return(true)
allow(merge_request).to receive(:base_performance_artifact).and_return(build)
allow(merge_request).to receive(:head_performance_artifact).and_return(build)
allow(merge_request).to receive_messages(
expose_performance_data?: true,
base_performance_artifact: build,
head_performance_artifact: build
)
expect(subject.as_json).to include(:performance)
end
......@@ -37,10 +41,12 @@ describe MergeRequestWidgetEntity do
it 'has sast data' do
build = create(:ci_build, name: 'sast', pipeline: pipeline)
allow(merge_request).to receive(:expose_sast_data?).and_return(true)
allow(merge_request).to receive(:base_has_sast_data?).and_return(true)
allow(merge_request).to receive(:base_sast_artifact).and_return(build)
allow(merge_request).to receive(:head_sast_artifact).and_return(build)
allow(merge_request).to receive_messages(
expose_sast_data?: true,
base_has_sast_data?: true,
base_sast_artifact: build,
head_sast_artifact: build
)
expect(subject.as_json).to include(:sast)
expect(subject.as_json[:sast]).to include(:head_path)
......@@ -50,10 +56,12 @@ describe MergeRequestWidgetEntity do
it 'has dependency_scanning data' do
build = create(:ci_build, name: 'dependency_scanning', pipeline: pipeline)
allow(merge_request).to receive(:expose_dependency_scanning_data?).and_return(true)
allow(merge_request).to receive(:base_has_dependency_scanning_data?).and_return(true)
allow(merge_request).to receive(:base_dependency_scanning_artifact).and_return(build)
allow(merge_request).to receive(:head_dependency_scanning_artifact).and_return(build)
allow(merge_request).to receive_messages(
expose_dependency_scanning_data?: true,
base_has_dependency_scanning_data?: true,
base_dependency_scanning_artifact: build,
head_dependency_scanning_artifact: build
)
expect(subject.as_json).to include(:dependency_scanning)
expect(subject.as_json[:dependency_scanning]).to include(:head_path)
......@@ -63,10 +71,12 @@ describe MergeRequestWidgetEntity do
it 'has license_management data' do
build = create(:ci_build, name: 'license_management', pipeline: pipeline)
allow(merge_request).to receive(:expose_license_management_data?).and_return(true)
allow(merge_request).to receive(:base_has_license_management_data?).and_return(true)
allow(merge_request).to receive(:base_license_management_artifact).and_return(build)
allow(merge_request).to receive(:head_license_management_artifact).and_return(build)
allow(merge_request).to receive_messages(
expose_license_management_data?: true,
base_has_license_management_data?: true,
base_license_management_artifact: build,
head_license_management_artifact: build
)
expect(subject.as_json).to include(:license_management)
expect(subject.as_json[:license_management]).to include(:head_path)
......@@ -76,10 +86,12 @@ describe MergeRequestWidgetEntity do
it 'has sast_container data' do
build = create(:ci_build, name: 'sast:image', pipeline: pipeline)
allow(merge_request).to receive(:expose_sast_container_data?).and_return(true)
allow(merge_request).to receive(:base_has_sast_container_data?).and_return(true)
allow(merge_request).to receive(:base_sast_container_artifact).and_return(build)
allow(merge_request).to receive(:head_sast_container_artifact).and_return(build)
allow(merge_request).to receive_messages(
expose_sast_container_data?: true,
base_has_sast_container_data?: true,
base_sast_container_artifact: build,
head_sast_container_artifact: build
)
expect(subject.as_json).to include(:sast_container)
expect(subject.as_json[:sast_container]).to include(:head_path)
......@@ -89,10 +101,12 @@ describe MergeRequestWidgetEntity do
it 'has dast data' do
build = create(:ci_build, name: 'dast', pipeline: pipeline)
allow(merge_request).to receive(:expose_dast_data?).and_return(true)
allow(merge_request).to receive(:base_has_dast_data?).and_return(true)
allow(merge_request).to receive(:base_dast_artifact).and_return(build)
allow(merge_request).to receive(:head_dast_artifact).and_return(build)
allow(merge_request).to receive_messages(
expose_dast_data?: true,
base_has_dast_data?: true,
base_dast_artifact: build,
head_dast_artifact: build
)
expect(subject.as_json).to include(:dast)
expect(subject.as_json[:dast]).to include(:head_path)
......
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