def test_clean_output(self, tmpdir): site = cli.Site.initialize(tmpdir.strpath) files = cli.ls_relative(site.root) assert 'output/index.html' not in files site.build() files = cli.ls_relative(site.root) assert 'output/index.html' in files site.clean_output() files = cli.ls_relative(site.root) assert 'output/index.html' not in files
def test_ls_relative(self): items = cli.ls_relative(join(test_root, 'fixtures', 'ls')) assert items == [ 'a.txt', 'b.md', 'c.html', 'd/e.css' ]
def test_initialize(self, tmpdir): site = cli.Site.initialize(tmpdir.strpath) files = cli.ls_relative(site.root) # Verify all the things we expected are present for name in templates.keys(): assert name in files # Verify we didn't find any extra stuff for file in files: assert templates[file] is not None
def generate(): output = 'templates = {\n' for filename in cli.ls_relative('templates'): contents = open(os.path.join('templates', filename)).read() output += '"%s":\n' % filename output += '"""' + contents + '""",\n' output += '}' f = open('templates.py', mode='w') f.write(output) f.close()
def generate(): output = '# -*- coding: utf-8 -*-\n\ntemplates = {\n' for filename in cli.ls_relative('templates'): contents = codecs.open(os.path.join('templates', filename), encoding='utf-8').read() output += '"%s":\n' % filename output += 'u"""' + contents + '""",\n' output += '}' f = codecs.open('icecake/templates.py', encoding='utf-8', mode='w') f.write(output) f.close()
def test_build(self, tmpdir): site = cli.Site.initialize(tmpdir.strpath) assert isfile(join(site.root, 'content', 'articles.html')) site.build() output_files = cli.ls_relative(join(site.root, 'output')) # Make sure all the files are there assert output_files == [ 'articles/hello-world/index.html', 'articles/index.html', 'atom.xml', 'css/main.css', 'css/syntax.css', 'index.html', 'tags/index.html' ]
def test_templates(self): for f in cli.ls_relative(join(module_root, 'templates')): contents = codecs.open(join(module_root, 'templates', f), encoding='utf-8').read() assert templates[f] == contents
def test_render_dependents(self, tmpdir): site = cli.Site.initialize(tmpdir.strpath) site.render_dependents('markdown.html') files = cli.ls_relative(site.root) assert 'output/articles/hello-world/index.html' in files
def test_templates(self): for f in cli.ls_relative(join(module_root, 'templates')): contents = open(join(module_root, 'templates', f)).read() assert templates[f] == contents