summaryrefslogtreecommitdiffstats
path: root/tests/commit_test.py
blob: e36f83548b86a4ccffc7b3f3e76a9153c89abc70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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)