From a9c06811cb420b9c2a5d502defdea1c74d3f71fa Mon Sep 17 00:00:00 2001 From: Maja Massarini Date: Mon, 10 Oct 2022 09:53:51 +0200 Subject: [PATCH] Improve table on github check page --- packit_service/worker/reporting.py | 10 +++++++++- tests/unit/test_reporting.py | 6 +++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packit_service/worker/reporting.py b/packit_service/worker/reporting.py index 5f1316066..051959ed4 100644 --- a/packit_service/worker/reporting.py +++ b/packit_service/worker/reporting.py @@ -17,6 +17,7 @@ from ogr.services.pagure import PagureProject from packit_service.constants import ( + DOCS_URL, MSG_TABLE_HEADER_WITH_DETAILS, ) @@ -378,12 +379,19 @@ def _create_table( ) -> str: table_content = [] if url: - table_content.append(f"| Dashboard | {url} |\n") + type_of_url = "" + if "dashboard.packit.dev" in url or "dashboard.stg.packit.dev": + type_of_url = "Dashboard" + elif DOCS_URL in url: + type_of_url = "Documentation" + table_content.append(f"| {type_of_url} | {url} |\n") if links_to_external_services is not None: table_content += [ f"| {name} | {link} |\n" for name, link in links_to_external_services.items() ] + if table_content: + table_content += "\n" return ( MSG_TABLE_HEADER_WITH_DETAILS + "".join(table_content) diff --git a/tests/unit/test_reporting.py b/tests/unit/test_reporting.py index fe2701c5d..7713b704c 100644 --- a/tests/unit/test_reporting.py +++ b/tests/unit/test_reporting.py @@ -449,12 +449,12 @@ def test_status_instead_check( def test_create_table(): assert create_table_content( - "dashboard-url", + "dashboard.packit.dev-url", {"Testing Farm": "tf-url", "COPR build": "copr-build-url"}, ) == ( "| Name/Job | URL |\n" "| --- | --- |\n" - "| Dashboard | dashboard-url |\n" + "| Dashboard | dashboard.packit.dev-url |\n" "| Testing Farm | tf-url |\n" - "| COPR build | copr-build-url |\n" + "| COPR build | copr-build-url |\n\n" )