This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
md-pdf/tests/__init__.py

38 lines
870 B
Python
Raw Normal View History

2017-05-27 20:32:50 +01:00
import unittest
2017-05-27 16:43:23 +01:00
import os
2017-05-28 14:11:35 +01:00
from md_pdf.consts import TEMPLATES_DIR, STATIC_DIR
2017-05-27 16:37:10 +01:00
2017-05-27 20:32:50 +01:00
class BaseTestCase(unittest.TestCase):
2017-05-28 16:58:58 +01:00
def setUp(self):
super().setUp()
self.BASE_VALID_CONFIG = {
'title': 'test title',
'input': 'test-files/*.md',
'output_formats': [
'html', 'pdf'
],
'output_dir': 'out/',
}
2017-05-28 14:11:35 +01:00
def removeFile(self, file):
try:
os.remove(file)
except OSError:
pass
2017-05-27 16:43:23 +01:00
def deleteTemplates(self):
for template in [
'header.html',
'footer.html',
'cover.html',
2017-05-28 14:11:35 +01:00
'toc.xsl',
2017-05-27 16:43:23 +01:00
]:
2017-05-28 14:11:35 +01:00
self.removeFile(os.path.join(TEMPLATES_DIR, template))
2017-05-27 16:43:23 +01:00
def tearDown(self):
self.deleteTemplates()
2017-05-28 14:11:35 +01:00
self.removeFile(os.path.join(STATIC_DIR, 'style.css'))