import basant.build.kitaab as kitaab from basant.shared import config from jinja2 import Environment, FileSystemLoader import pytest from os import listdir @pytest.fixture(scope="session") def fake_kitaab(tmp_path_factory): directory = tmp_path_factory.mktemp("public") # Tag file tags_file = directory / ".vimwiki_tags" with open(tags_file, 'w') as fobj: fobj.write(""" !_TAG_FILE_FORMAT 2 !_TAG_FILE_SORTED 1 !_TAG_OUTPUT_MODE vimwiki-tags !_TAG_PROGRAM_AUTHOR Vimwiki !_TAG_PROGRAM_NAME Vimwiki Tags !_TAG_PROGRAM_URL https://github.com/vimwiki/vimwiki !_TAG_PROGRAM_VERSION 2.5 jrnl 201017-1546.wiki 2;" vimwiki:201017-1546\t201017-1546 dev 201018-1546.wiki 2;" vimwiki:201018-1546\t201018-1546 """) # :jrnl: page jrnl_file = directory / "201017-1546.wiki" with open(jrnl_file, 'w') as fobj: fobj.write(""" %title 5th June 2018 at 21:56 :jrnl: %date 2018-06-05 21:56 Some jrnl entry """) # :dev: page dev_file = directory / "201018-1546.wiki" with open(jrnl_file, 'w') as fobj: fobj.write(""" %title Some dev entry :dev: %date 2018-06-05 21:56 Some dev entry """) return directory class TestGeneration: def test_generate_index_pages(self, fake_kitaab): print(listdir(fake_kitaab)) kitaab.generate_index_pages() print(listdir(fake_kitaab)) # Build the files by filling out the template file_loader = FileSystemLoader('') env = Environment(loader=file_loader) # regular index pagse use main template template = env.get_template(config.template_main) page_title = 'Dev index' with open(fake_kitaab / 'dev_index.html') as dev_index: html = dev_index.readlines() assert 0 def test_generate_html_pages(self, fake_kitaab): kitaab.generate_html_pages() assert 0 def test_generate_head(self, fake_kitaab): kitaab.generate_head() assert 0 def test_generate_navigation(self, fake_kitaab): kitaab.generate_navigation() assert 0 def test_generate_sub_pages(self, fake_kitaab): kitaab.generate_sub_pages() assert 0