From 9dc1ba0f09329ed2ee0b1408520b043021f9d7ab Mon Sep 17 00:00:00 2001 From: Laura Barcziova Date: Fri, 15 Nov 2024 10:30:08 +0100 Subject: [PATCH] Expose number of found defects in OSH via API --- packit_service/service/api/osh_scans.py | 1 + tests_openshift/conftest.py | 2 ++ tests_openshift/service/test_api.py | 1 + 3 files changed, 4 insertions(+) diff --git a/packit_service/service/api/osh_scans.py b/packit_service/service/api/osh_scans.py index 178771afc..d70a7c30b 100644 --- a/packit_service/service/api/osh_scans.py +++ b/packit_service/service/api/osh_scans.py @@ -63,6 +63,7 @@ def get_scan_info(scan: OSHScanModel) -> dict: "task_id": scan.task_id, "status": scan.status, "url": scan.url, + "issues_added_count": scan.issues_added_count, "issues_added_url": scan.issues_added_url, "issues_fixed_url": scan.issues_fixed_url, "scan_results_url": scan.scan_results_url, diff --git a/tests_openshift/conftest.py b/tests_openshift/conftest.py index 37dec33a2..d90c58f03 100644 --- a/tests_openshift/conftest.py +++ b/tests_openshift/conftest.py @@ -168,6 +168,7 @@ class SampleValues: # scan task_id = 123 scan_url = "https://scan-url" + issues_added_count = 3 issues_added_url = "https://issues-added-url" issues_fixed_url = "https://issues-fixed-url" scan_results_url = "https://scan-results-url" @@ -2503,4 +2504,5 @@ def a_scan(a_copr_build_for_pr): scan.issues_added_url = SampleValues.issues_added_url scan.issues_fixed_url = SampleValues.issues_fixed_url scan.scan_results_url = SampleValues.scan_results_url + scan.issues_added_count = SampleValues.issues_added_count yield scan diff --git a/tests_openshift/service/test_api.py b/tests_openshift/service/test_api.py index 571424c1b..e972ced56 100644 --- a/tests_openshift/service/test_api.py +++ b/tests_openshift/service/test_api.py @@ -979,6 +979,7 @@ def test_scan_info( assert response_dict["repo_namespace"] == SampleValues.repo_namespace assert response_dict["repo_name"] == SampleValues.repo_name assert response_dict["project_url"] == SampleValues.project_url + assert response_dict["issues_added_count"] == SampleValues.issues_added_count def test_scans_list(