diff options
Diffstat (limited to 'tests/log_page_test.py')
| -rw-r--r-- | tests/log_page_test.py | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/tests/log_page_test.py b/tests/log_page_test.py index 041544e..da00fd0 100644 --- a/tests/log_page_test.py +++ b/tests/log_page_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, '', 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, '', None) context = page.context() assert(context['title'] == 'log test: Log') assert(context['commits'] == []) @@ -18,10 +18,11 @@ 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, '', commit) context = page.context() assert(context['title'] == 'log test: Log') assert(context['commits'] == [{'committed_datetime': 0, 'hexsha': 1234, 'refs': [], 'summary': 'mock commit'}]) + assert(context['this_commit'] == commit) def test_context_matching_branch_no_tags(): commit = MagicMock() @@ -31,7 +32,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, '', None) context = page.context() assert(context['title'] == 'log test: Log') assert(context['commits'] == [{'committed_datetime': 0, 'hexsha': 1234, 'refs': ['mock branch'], 'summary': 'mock commit'}]) @@ -44,7 +45,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, '', None) context = page.context() assert(context['title'] == 'log test: Log') assert(context['commits'] == [{'committed_datetime': 0, 'hexsha': 1234, 'refs': [], 'summary': 'mock commit'}]) @@ -57,7 +58,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], '', None) context = page.context() assert(context['commits'] == [{'committed_datetime': 0, 'hexsha': 1234, 'refs': ['mock tag'], 'summary': 'mock commit'}]) @@ -69,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], '', None) context = page.context() assert(context['title'] == 'log test: Log') assert(context['commits'] == [{'committed_datetime': 0, 'hexsha': 1234, 'refs': [], 'summary': 'mock commit'}]) @@ -85,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], '', None) context = page.context() assert(context['title'] == 'log test: Log') assert(context['commits'] == [{'committed_datetime': 0, 'hexsha': 1234, 'refs': [], 'summary': 'mock commit'}]) @@ -101,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], '', None) context = page.context() assert(context['title'] == 'log test: Log') assert(context['commits'] == [{'committed_datetime': 0, 'hexsha': 1234, 'refs': ['mock branch', 'mock tag'], 'summary': 'mock commit'}]) @@ -115,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, '', None) context = page.context() assert(context['title'] == 'log test: Log') assert(context['commits'] == [ @@ -135,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, '', None) context = page.context() assert(context['title'] == 'log test: Log') assert(context['commits'] == [ @@ -155,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], '', None) context = page.context() assert(context['title'] == 'log test: Log') assert(context['commits'] == [ @@ -178,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], '', None) context = page.context() assert(context['title'] == 'log test: Log') assert(context['commits'] == [ |