From 112d22b6ed44178ec4fb648b1132d4d35512a3d5 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sun, 28 May 2017 13:21:22 +0100 Subject: [PATCH] Add basic pandoc build tests --- tests/test_pandoc.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/test_pandoc.py b/tests/test_pandoc.py index e29e281..531e6a2 100644 --- a/tests/test_pandoc.py +++ b/tests/test_pandoc.py @@ -3,6 +3,7 @@ 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' @@ -24,3 +25,24 @@ class OutputHTMLTestCase(BaseTestCase): with open(os.path.join(self.output_dir, 'output.html')) as f: self.assertEqual(f.read(), 'test') + +class BuildDocumentTestCase(BaseTestCase): + def test_parses_markdown(self): + doc = build_document('# test', None) + self.assertIn('

test

', doc) + + def test_bibliography(self): + bibliography = { + 'references': 'test-files/bib.yaml', + 'csl': 'chicago-author-date' + } + with open('test-files/2-pandoc.md') as f: + test_content = f.read() + doc = build_document(test_content, bibliography) + self.assertIn( + 'Doe (2005, 2006, 30; see also Doe and Roe 2007) says blah.', + doc + ) + self.assertIn('Doe, John. 2005.', doc) + self.assertIn('
', doc) +