summaryrefslogtreecommitdiffstats
path: root/tests/commit_test.py
diff options
context:
space:
mode:
authorChristoph Schlosser <christoph@linux.com>2025-08-24 17:37:43 +0200
committerChristoph Schlosser <christoph@linux.com>2025-08-24 17:42:39 +0200
commit0b3f38b3786c1b738165778d210453e1c2bfe309 (patch)
treef42d9533f1e5eee76b6fe147414dec53bf4eff1f /tests/commit_test.py
parent8f2f0d5d1176794bb7df2c42c54b7211e155d331 (diff)
downloadgit2hugo-0b3f38b3786c1b738165778d210453e1c2bfe309.tar.gz
g2h: Add commit page
Diffstat (limited to 'tests/commit_test.py')
-rw-r--r--tests/commit_test.py19
1 files changed, 19 insertions, 0 deletions
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)
+