From e71650cd3c5d3702e9ca9e8204428d05d5f93c5b Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sun, 28 May 2017 15:51:52 +0100 Subject: [PATCH] Test hard extra config --- tests/test_context.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/test_context.py diff --git a/tests/test_context.py b/tests/test_context.py new file mode 100644 index 0000000..69d9ee4 --- /dev/null +++ b/tests/test_context.py @@ -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__)