summaryrefslogtreecommitdiffstats
path: root/tests/overview_page_test.py
blob: 2e7b32c512b3eed205f8cef5cd85b9a0179b40ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from unittest.mock import Mock

from src.g2h.overview_page import OverviewPage

def test_init():
    commit = Mock()
    commit.committed_datetime = '2025-04-01T12:34:56+00:00'
    commit.hexsha = 'abc'
    page = OverviewPage('test/overview', 'overview test', 'test branch', 'test tag', 'overview/sub/dir', commit)
    context = page.context()
    assert(context['title'] == 'overview test')
    assert(context['branches'] == 'test branch')
    assert(context['tags'] == 'test tag')
    assert(context['content_subdir'] == 'overview/sub/dir')
    assert(context['latest_commit_date'] == '2025-04-01T12:34:56+00:00')
    assert(context['this_commit'] == commit)