Test file reader
This commit is contained in:
parent
392703e3cb
commit
ddb51ceee4
2 changed files with 17 additions and 1 deletions
|
@ -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))
|
||||
|
|
|
@ -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):
|
||||
|
|
Reference in a new issue