Files
longhikes/web/tests/test_logo_states.py
T
swaitsandClaude Fable 5.2 24bfbb2fa8
Mirror to forge / mirror (push) Canceled after 0s
Validate / validate (push) Canceled after 0s
Validate / history (push) Canceled after 0s
Validate / site (push) Canceled after 0s
Validate / deploy (push) Canceled after 0s
Show each trail's own emblem, keep a history on every record, and list what was left out
- Emblems for 81 trails, up from 41. Each is the trail's own crest, badge
  or roundel alone, cropped out of a larger logo where need be and made
  transparent where that could be done cleanly. Records without one say
  where an emblem was looked for. The validator checks the logo state.
- Every record has a `[[history]]` list: what changed or was asked for,
  on what basis, who asked and whether it was applied or declined.
  `tools/check_history.py` fails a changed fact with no history entry and
  prints earlier entries about a changed field. It runs in CI before the
  site deploys. Each trail page shows the history.
- A new page, "Considered and left out", built from `left-out.toml`:
  35 trails and routes with the reason, the deciding fact and its source.
- The Hoosier Heritage Trail has its ends, its free map set and its
  emblem from its association (issue 2). Any trail may list its holder's
  own guide or map set.
- A stated permission is quoted in the download credit box.
- `tools/gpx_track.py` turns a GPX file from a holder or a hiker into a
  record's track files.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-16 13:40:03 -07:00

42 lines
1.5 KiB
Python

"""What a trail page says for each state of [shield], from the record alone."""
import html
import os
import sys
import unittest
WEB = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, WEB)
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from olt import trail, words # noqa: E402
from test_pages import sample_record # noqa: E402
def logo_text(status, note):
rec = sample_record("Example Trail")
rec["shield"].update({"status": status, "note": note})
return html.unescape(str(trail.logo_block(rec)))
class LogoStatesTest(unittest.TestCase):
def test_no_emblem_of_its_own(self):
text = logo_text("no-logo-exists", "Looked at the association's site.")
self.assertIn("No emblem of its own", text)
self.assertIn("Looked at the association's site.", text)
self.assertNotIn("Emblem not found", text)
def test_emblem_not_found(self):
text = logo_text("logo-not-found", "A sign shows one.")
self.assertIn("Emblem not found", text)
self.assertIn("exists or may exist", text)
self.assertIn("A sign shows one.", text)
self.assertNotIn("No emblem of its own", text)
def test_words_agree_with_the_block(self):
self.assertEqual(words.label(words.SHIELD_STATUS, "no-logo-exists"), "No emblem of its own")
self.assertEqual(words.label(words.SHIELD_STATUS, "logo-not-found"), "Emblem not found")
if __name__ == "__main__":
unittest.main()