Test html output

This commit is contained in:
Jake Howard 2017-05-28 12:33:34 +01:00
parent 16b6002205
commit c6100c04c6
3 changed files with 28 additions and 2 deletions

View file

@ -15,7 +15,7 @@ def build(config):
logger.debug("Starting Build...")
start_time = time.time()
data = read_files(os.path.abspath(config['input']))
doc = build_document(data, config.get('bibliography'), config.get('context'))
doc = build_document(data, config.get('bibliography'))
parsed_template = parse_template(doc, config)
if 'html' in config['output_formats']:
output_html(parsed_template, os.path.abspath(config['output_dir']))

View file

@ -12,7 +12,7 @@ def output_html(html, out_dir):
f.write(html)
def build_document(files_content, bibliography, context):
def build_document(files_content, bibliography):
args = [
'-s',
]

26
tests/test_pandoc.py Normal file
View file

@ -0,0 +1,26 @@
from tests import BaseTestCase
from md_pdf.build.pandoc import output_html, build_document
from md_pdf.utils import remove_dir
import os
class OutputHTMLTestCase(BaseTestCase):
output_dir = 'test-output'
def setUp(self):
super().setUp()
os.makedirs(self.output_dir)
def tearDown(self):
super().tearDown()
remove_dir(self.output_dir)
def test_outputs_file(self):
self.assertFalse(os.path.isfile(os.path.join(self.output_dir, 'output.html')))
output_html('test', self.output_dir)
self.assertTrue(os.path.isfile(os.path.join(self.output_dir, 'output.html')))
def test_outputs_correct_data(self):
output_html('test', self.output_dir)
with open(os.path.join(self.output_dir, 'output.html')) as f:
self.assertEqual(f.read(), 'test')