fix(set_report_color): Add more details to error (#6751)

This commit is contained in:
Pepe Fagoaga
2025-01-30 20:48:51 +05:45
committed by GitHub
parent 5bfaedf903
commit 5186e029b3
2 changed files with 6 additions and 4 deletions
+3 -1
View File
@@ -83,7 +83,9 @@ def set_report_color(status: str, muted: bool = False) -> str:
elif status == "MANUAL":
color = Fore.YELLOW
else:
raise Exception("Invalid Report Status. Must be PASS, FAIL or MANUAL.")
raise Exception(
f"Invalid Report Status: {status}. Must be PASS, FAIL or MANUAL."
)
return color
+3 -3
View File
@@ -21,7 +21,6 @@ from prowler.lib.outputs.utils import (
class TestOutputs:
def test_set_report_color(self):
test_status = ["PASS", "FAIL", "MANUAL"]
test_colors = [Fore.GREEN, Fore.RED, Fore.YELLOW]
@@ -35,8 +34,9 @@ class TestOutputs:
with pytest.raises(Exception) as exc:
set_report_color(test_status)
assert "Invalid Report Status. Must be PASS, FAIL or MANUAL" in str(exc.value)
assert exc.type == Exception
assert "Invalid Report Status: INVALID. Must be PASS, FAIL or MANUAL" in str(
exc.value
)
def test_unroll_list_no_separator(self):
list = ["test", "test1", "test2"]