diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/commit_test.py | 4 | ||||
| -rw-r--r-- | tests/log_test.py | 26 | ||||
| -rw-r--r-- | tests/overview_test.py | 2 | ||||
| -rw-r--r-- | tests/page_test.py | 8 |
4 files changed, 20 insertions, 20 deletions
diff --git a/tests/commit_test.py b/tests/commit_test.py index e36f835..1d79f1e 100644 --- a/tests/commit_test.py +++ b/tests/commit_test.py @@ -4,7 +4,7 @@ from unittest.mock import MagicMock def test_init(): commit = MagicMock() commit.hexsha = '123' - page = CommitPage('test/commit', 'commit test', commit) + 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') @@ -12,7 +12,7 @@ def test_init(): def test_context(): commit = MagicMock() commit.hexsha = '123' - page = CommitPage('test/commit', 'commit test', commit) + page = CommitPage('test/commit', 'commit test', commit, '') context = page.context() assert(context['title'] == 'commit test: 123') assert(context['commit'] == commit) diff --git a/tests/log_test.py b/tests/log_test.py index 1efe3bd..c0619de 100644 --- a/tests/log_test.py +++ b/tests/log_test.py @@ -2,13 +2,13 @@ from g2h.log_page import LogPage from unittest.mock import MagicMock def test_init(): - page = LogPage('test/log', 'log test', None, None, None) + page = LogPage('test/log', 'log test', None, None, None, '') assert(page.name == 'log test') assert(page.out_file_path == 'test/log/l.md') assert(page.template.name == 'log.md') def test_context_no_commits(): - page = LogPage('test/log', 'log test', None, None, None) + page = LogPage('test/log', 'log test', None, None, None, '') context = page.context() assert(context['title'] == 'log test: Log') assert(context['commits'] == []) @@ -18,7 +18,7 @@ def test_context_no_branches_and_tags(): commit.summary = 'mock commit' commit.hexsha = 1234; commit.committed_datetime = 0 - page = LogPage('test/log', 'log test', [commit], None, None) + page = LogPage('test/log', 'log test', [commit], None, None, '') context = page.context() assert(context['title'] == 'log test: Log') assert(context['commits'] == [{'committed_datetime': 0, 'refs': [], 'summary': 'mock commit'}]) @@ -31,7 +31,7 @@ def test_context_matching_branch_no_tags(): branch = MagicMock() branch.commit.hexsha = commit.hexsha branch.name = 'mock branch' - page = LogPage('test/log', 'log test', [commit], [branch], None) + page = LogPage('test/log', 'log test', [commit], [branch], None, '') context = page.context() assert(context['title'] == 'log test: Log') assert(context['commits'] == [{'committed_datetime': 0, 'refs': ['mock branch'], 'summary': 'mock commit'}]) @@ -44,7 +44,7 @@ def test_context_unmatching_branch_no_tags(): branch = MagicMock() branch.commit.hexsha = 4321 branch.name = 'mock branch' - page = LogPage('test/log', 'log test', [commit], [branch], None) + page = LogPage('test/log', 'log test', [commit], [branch], None, '') context = page.context() assert(context['title'] == 'log test: Log') assert(context['commits'] == [{'committed_datetime': 0, 'refs': [], 'summary': 'mock commit'}]) @@ -57,7 +57,7 @@ def test_context_no_branch_matching_tag(): tag = MagicMock() tag.commit.hexsha = commit.hexsha tag.name = 'mock tag' - page = LogPage('test/log', 'log test', [commit], None, [tag]) + page = LogPage('test/log', 'log test', [commit], None, [tag], '') context = page.context() assert(context['title'] == 'log test: Log') assert(context['commits'] == [{'committed_datetime': 0, 'refs': ['mock tag'], 'summary': 'mock commit'}]) @@ -70,7 +70,7 @@ def test_context_no_branch_no_matching_tag(): tag = MagicMock() tag.commit.hexsha = 4321 tag.name = 'mock tag' - page = LogPage('test/log', 'log test', [commit], None, [tag]) + page = LogPage('test/log', 'log test', [commit], None, [tag], '') context = page.context() assert(context['title'] == 'log test: Log') assert(context['commits'] == [{'committed_datetime': 0, 'refs': [], 'summary': 'mock commit'}]) @@ -86,7 +86,7 @@ def test_context_no_matching_branch_no_matching_tag(): tag = MagicMock() tag.commit.hexsha = 4321 tag.name = 'mock tag' - page = LogPage('test/log', 'log test', [commit], [branch], [tag]) + page = LogPage('test/log', 'log test', [commit], [branch], [tag], '') context = page.context() assert(context['title'] == 'log test: Log') assert(context['commits'] == [{'committed_datetime': 0, 'refs': [], 'summary': 'mock commit'}]) @@ -102,7 +102,7 @@ def test_context_matching_branch_matching_tag(): tag = MagicMock() tag.commit.hexsha = commit.hexsha tag.name = 'mock tag' - page = LogPage('test/log', 'log test', [commit], [branch], [tag]) + page = LogPage('test/log', 'log test', [commit], [branch], [tag], '') context = page.context() assert(context['title'] == 'log test: Log') assert(context['commits'] == [{'committed_datetime': 0, 'refs': ['mock branch', 'mock tag'], 'summary': 'mock commit'}]) @@ -116,7 +116,7 @@ def test_multiple_commits(): commit2.summary = 'mock commit 2' commit2.hexsha = 2; commit2.committed_datetime = 1 - page = LogPage('test/log', 'log test', [commit1, commit2], None, None) + page = LogPage('test/log', 'log test', [commit1, commit2], None, None, '') context = page.context() assert(context['title'] == 'log test: Log') assert(context['commits'] == [ @@ -136,7 +136,7 @@ def test_multiple_commits_branch(): branch = MagicMock() branch.commit.hexsha = 1 branch.name = 'mock branch' - page = LogPage('test/log', 'log test', [commit1, commit2], [branch], None) + page = LogPage('test/log', 'log test', [commit1, commit2], [branch], None, '') context = page.context() assert(context['title'] == 'log test: Log') assert(context['commits'] == [ @@ -156,7 +156,7 @@ def test_multiple_commits_tag(): tag = MagicMock() tag.commit.hexsha = 1 tag.name = 'mock tag' - page = LogPage('test/log', 'log test', [commit1, commit2], None, [tag]) + page = LogPage('test/log', 'log test', [commit1, commit2], None, [tag], '') context = page.context() assert(context['title'] == 'log test: Log') assert(context['commits'] == [ @@ -179,7 +179,7 @@ def test_multiple_commits_branch_and_tag(): tag = MagicMock() tag.commit.hexsha = 2 tag.name = 'mock tag' - page = LogPage('test/log', 'log test', [commit1, commit2], [branch], [tag]) + page = LogPage('test/log', 'log test', [commit1, commit2], [branch], [tag], '') context = page.context() assert(context['title'] == 'log test: Log') assert(context['commits'] == [ diff --git a/tests/overview_test.py b/tests/overview_test.py index fa51858..57d2f5d 100644 --- a/tests/overview_test.py +++ b/tests/overview_test.py @@ -1,7 +1,7 @@ from g2h.overview_page import OverviewPage def test_init(): - page = OverviewPage('test/overview', 'overview test', 'test branch', 'test tag') + page = OverviewPage('test/overview', 'overview test', 'test branch', 'test tag', '') context = page.context() assert(context['title'] == 'overview test') assert(context['branches'] == 'test branch') diff --git a/tests/page_test.py b/tests/page_test.py index 1008a8d..c68e435 100644 --- a/tests/page_test.py +++ b/tests/page_test.py @@ -3,17 +3,17 @@ from jinja2.exceptions import TemplateNotFound import pytest def test_init(): - page = Page('overview.md', 'dir', 'file', 'name') + page = Page('overview.md', 'dir', 'file', 'name', 'sub/dir') assert(page.name == 'name') assert(page.out_file_path == 'dir/file') assert(page.template.name == 'overview.md') + assert(page.content_subdir == 'sub/dir') def test_wrong_template(): with pytest.raises(TemplateNotFound): - Page('not existant.md', 'dir', 'file', 'name') + Page('not existant.md', 'dir', 'file', 'name', '') def test_no_context(): - page = Page('overview.md', 'dir', 'file', 'name') + page = Page('overview.md', 'dir', 'file', 'name', '') with pytest.raises(NotImplementedError): page.context() - |