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()
