split total counts for other packages

This commit is contained in:
David Duran Rosich committed 2026-10-25 11:17:45 +01:00
1 parent 66808d77f0
commit 9cabdefdf4
2 files changed
+45 -14

No files matched your search

+12 -6
View File
@@ -498,15 +498,19 @@ class ReportTests(unittest.TestCase):
def test_build_other_containers_body_has_counts_per_container(self) -> None:
bodies = scan.build_other_containers_bodies(
[
("nginx:1.27", "web-worker", 3, 2, 1),
("redis:7", "cache", 4, 0, 4),
("nginx:1.27", "web-worker", 3, 2, 1, {"CRITICAL":1,"HIGH":2,"MEDIUM":0,"LOW":0}, {"CRITICAL":1,"HIGH":1,"MEDIUM":0,"LOW":0}),
("redis:7", "cache", 4, 0, 4, {"CRITICAL":0,"HIGH":4,"MEDIUM":0,"LOW":0}, {"CRITICAL":0,"HIGH":0,"MEDIUM":0,"LOW":0}),
]
)
body = bodies[0]
self.assertIn("Other containers with findings", body)
self.assertIn("nginx:1.27 [web-worker]: 2/3 (fixable/total)", body)
self.assertIn("redis:7 [cache]: 0/4 (fixable/total)", body)
self.assertIn("Total: 7 CVE(s) in 2 container(s)", body)
self.assertIn("nginx:1.27 [web-worker]", body)
self.assertIn("C 1/1 H 1/2 M 0/0 L 0/0", body)
self.assertIn("Total: 2/3", body)
self.assertIn("redis:7 [cache]", body)
self.assertIn("C 0/0 H 0/4 M 0/0 L 0/0", body)
self.assertIn("Total: 0/4", body)
self.assertIn("Total: 2/7 in 2 container(s)", body)
def test_build_missing_body_separates_missing_and_unscanned(self) -> None:
body = scan.build_missing_body(["gone"], ["web"])
@@ -670,7 +674,9 @@ printf '%s\\n' "$*" >> "$APPRISE_LOG"
self.assertIn("Container: web", notification)
self.assertIn("CVE-2026-0001", notification)
self.assertIn("Vulnerability scan: other containers", notification)
self.assertIn("redis:7 [cache]: 1/1 (fixable/total)", notification)
self.assertIn("redis:7 [cache]", notification)
self.assertIn("C 0/0 H 0/1 M 0/0 L 0/0", notification)
self.assertIn("Total: 0/1", notification)
self.assertIn("1/1 (fixable/total)", notification)
# The important container must not also appear in the summary.
self.assertNotIn("testphp-php [web]", notification)