From ddb51ceee467895a536a84cc63016f82908fba36 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 8 Jun 2017 12:26:15 +0100 Subject: [PATCH] Test file reader --- md_pdf/config/read.py | 2 +- tests/test_pandoc.py | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/md_pdf/config/read.py b/md_pdf/config/read.py index 046064b..20ad7d2 100644 --- a/md_pdf/config/read.py +++ b/md_pdf/config/read.py @@ -6,7 +6,7 @@ from md_pdf.exceptions import ConfigValidationException def load_config(location=CONFIG_FILE): try: - with open(os.path.join(location)) as f: + with open(location) as f: return yaml.safe_load(f) except FileNotFoundError: raise ConfigValidationException("Can't find config file at {}".format(CONFIG_FILE)) diff --git a/tests/test_pandoc.py b/tests/test_pandoc.py index 4725bbc..df933a7 100644 --- a/tests/test_pandoc.py +++ b/tests/test_pandoc.py @@ -1,7 +1,23 @@ from tests import BaseTestCase from md_pdf.build.pandoc import output_html, build_document +from md_pdf.build.md import read_files from md_pdf.utils import remove_dir import os +import glob + + +class ReadFileTestCase(BaseTestCase): + file_glob = 'test-files/*.md' + + def test_reads_files(self): + files = read_files(self.file_glob) + self.assertNotEqual(files, '') + + def test_contains_all_files(self): + files = read_files(self.file_glob) + for file in glob.iglob(self.file_glob): + with open(file) as f: + self.assertIn(f.read(), files) class OutputHTMLTestCase(BaseTestCase):