Test hard extra config

This commit is contained in:
Jake Howard 2017-05-28 15:51:52 +01:00
parent 3e7759c52d
commit e71650cd3c

22
tests/test_context.py Normal file
View file

@ -0,0 +1,22 @@
from tests import BaseTestCase
from md_pdf.build.context import get_context, EXTRA_CONTEXT
from md_pdf import consts
from datetime import datetime
from md_pdf import __version__
class ExtraContextTestCase(BaseTestCase):
def test_directories(self):
self.assertEqual(EXTRA_CONTEXT['templates_dir'], consts.TEMPLATES_DIR)
self.assertEqual(EXTRA_CONTEXT['static_dir'], consts.STATIC_DIR)
self.assertEqual(EXTRA_CONTEXT['internal_templates_dir'], consts.INTERNAL_TEMPLATES_DIR)
self.assertEqual(EXTRA_CONTEXT['internal_static_dir'], consts.INTERNAL_STATIC_DIR)
def test_datetimes(self):
now = datetime.now()
self.assertEqual(EXTRA_CONTEXT['date'], now.strftime(consts.DATE_FORMAT))
self.assertEqual(EXTRA_CONTEXT['time'], now.strftime(consts.TIME_FORMAT))
self.assertEqual(EXTRA_CONTEXT['datetime'], now.strftime(consts.DATETIME_FORMAT))
def test_version(self):
self.assertEqual(EXTRA_CONTEXT['mdp_version'], __version__)