From 0b3f38b3786c1b738165778d210453e1c2bfe309 Mon Sep 17 00:00:00 2001 From: Christoph Schlosser Date: Sun, 24 Aug 2025 17:37:43 +0200 Subject: g2h: Add commit page --- tests/commit_test.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/commit_test.py (limited to 'tests/commit_test.py') diff --git a/tests/commit_test.py b/tests/commit_test.py new file mode 100644 index 0000000..e36f835 --- /dev/null +++ b/tests/commit_test.py @@ -0,0 +1,19 @@ +from g2h.commit_page import CommitPage +from unittest.mock import MagicMock + +def test_init(): + commit = MagicMock() + commit.hexsha = '123' + page = CommitPage('test/commit', 'commit test', commit) + assert(page.name == 'commit test') + assert(page.out_file_path == 'test/commit/123/index.md') + assert(page.template.name == 'commit.md') + +def test_context(): + commit = MagicMock() + commit.hexsha = '123' + page = CommitPage('test/commit', 'commit test', commit) + context = page.context() + assert(context['title'] == 'commit test: 123') + assert(context['commit'] == commit) + -- cgit v1.2.3