fix: name a served sha1 only when it differs

A RomM row printed the served copy's sha1 under the same SHA1 it
had just declared, 313 times on the page. The note stays where the
copy is not one the row declares.
This commit is contained in:
Abdessamad Derraz committed 2026-11-05 14:36:14 +01:00
1 parent da5f24b74a
commit 21b8d902e3
2 files changed
+12 -4

No files matched your search

+5
View File
@@ -152,6 +152,11 @@ class EachEntryNamesItsFile(unittest.TestCase):
self.assertRegex(served, rf"\]\(\.\./systems/[^)]+\.md#sha1-{digest[:12]}\)")
self.assertTrue(served.startswith("Served by: "))
self.assertIn(f"`{digest[:8]}`", served)
# The row already shows the declared sha1: repeating it said nothing.
quiet = generate_site._served_line({"status": "ok", "path": path}, f"aaaa, {digest.upper()}")
self.assertNotIn(digest[:8], quiet.split(")", 1)[1])
self.assertIn(f"`{digest[:8]}`", generate_site._served_line(
{"status": "ok", "path": path}, "a" * 40))
self.assertEqual(generate_site._served_line({"status": "missing"}), "Not held")
self.assertTrue(generate_site._served_line(
{"status": "untested", "path": path}).startswith("Held, not the declared hash"))