summaryrefslogtreecommitdiffstats
path: root/tests/commit_test.py
diff options
context:
space:
mode:
authorChristoph Schlosser <christoph@linux.com>2025-08-31 01:09:37 +0200
committerChristoph Schlosser <christoph@linux.com>2025-08-31 15:53:33 +0200
commit284f3972844ea124c0cd9ee5500e99440bb96aac (patch)
treeb8dee22222c38b12cc00daf98280e1b2060bcca7 /tests/commit_test.py
parentb06dbf67b9ac9e329922d7911ee7a9b09419c5f0 (diff)
downloadgit2hugo-284f3972844ea124c0cd9ee5500e99440bb96aac.tar.gz
g2h: Add file page
Also move helpers to dedicated files.
Diffstat (limited to 'tests/commit_test.py')
-rw-r--r--tests/commit_test.py37
1 files changed, 0 insertions, 37 deletions
diff --git a/tests/commit_test.py b/tests/commit_test.py
deleted file mode 100644
index b32901e..0000000
--- a/tests/commit_test.py
+++ /dev/null
@@ -1,37 +0,0 @@
-from g2h.commit_page import CommitPage, redact_email
-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'
- commit.author.email = 'unit@te.st'
- page = CommitPage('test/commit', 'commit test', commit, 'commit/content')
- context = page.context()
- assert(context['title'] == 'commit test: 123')
- assert(context['commit'] == commit)
- assert(context['redacted_email'] == 'u...t@te...st')
- assert(context['content_subdir'] == 'commit/content')
-
-def test_redacting_email():
- assert(redact_email(None) == '')
- assert(redact_email('') == '')
- assert(redact_email('a') == 'a...a')
- assert(redact_email('az') == 'a...z')
- assert(redact_email('root') == 'r...t')
- assert(redact_email('root@localhost') == 'r...t@localhost')
- assert(redact_email('test@example.com') == 't...t@example...com')
- assert(redact_email('test@sub.example.com') == 't...t@sub...example...com')
- assert(redact_email('az@example.com') == 'a...z@example...com')
- assert(redact_email('a@example.com') == 'a...a@example...com')
- assert(redact_email('@example.com') == '@example...com')
- assert(redact_email('test@') == 't...t@')
- assert(redact_email('az@') == 'a...z@')
- assert(redact_email('@') == '@')