summaryrefslogtreecommitdiffstats
path: root/tests/base_page_test.py
blob: c68e4357df5e19cb53ac0f1cc010008252d34e35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from g2h.page import Page
from jinja2.exceptions import TemplateNotFound
import pytest

def test_init():
    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', '')

def test_no_context():
    page = Page('overview.md', 'dir', 'file', 'name', '')
    with pytest.raises(NotImplementedError):
        page.context()