25 lines
824 B
Python
25 lines
824 B
Python
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
import unittest
|
|
|
|
|
|
class HomeTemplateTests(unittest.TestCase):
|
|
def test_recent_activity_adds_only_latest_devlog_from_each_project(self) -> None:
|
|
site_root = Path(__file__).resolve().parents[1]
|
|
template = (site_root / "templates" / "home.html").read_text(encoding="utf-8")
|
|
recent_activity = template.split(
|
|
'<section class="homepage-panel featured-projects-panel"', 1
|
|
)[0]
|
|
|
|
self.assertIn(
|
|
"devlog.children.order_by('-date', '-source_commit_time').first()",
|
|
recent_activity,
|
|
)
|
|
self.assertIn("entries.append(latest_devlog_entry)", recent_activity)
|
|
self.assertNotIn("for entry in devlog.children", recent_activity)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|