diff options
author | Markus Krogh <markus@nordu.net> | 2016-03-08 18:51:12 +0000 |
---|---|---|
committer | Markus Krogh <markus@nordu.net> | 2016-03-08 18:51:12 +0000 |
commit | c00e57756336358e9800fc8fc89392253dbf4ed8 (patch) | |
tree | b005152d9bd390c3e2a8912247fff43dfbbbfde6 /test | |
parent | 5c365f875986ffb38345e789a450639b1b833b24 (diff) |
Initial commmit, still needs wireing for email
Diffstat (limited to 'test')
-rw-r--r-- | test/__init__.py | 0 | ||||
-rw-r--r-- | test/test_templates.py | 61 |
2 files changed, 61 insertions, 0 deletions
diff --git a/test/__init__.py b/test/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/__init__.py diff --git a/test/test_templates.py b/test/test_templates.py new file mode 100644 index 0000000..ee05ac6 --- /dev/null +++ b/test/test_templates.py @@ -0,0 +1,61 @@ +from maconomy import UnsubmittedEmailTemplate, MissingEmailTemplate, ManagerEmailTemplate, Employee +import unittest + +class UnsubmittedEmailTemplateTest(unittest.TestCase): + + def setUp(self): + self.template = UnsubmittedEmailTemplate() + + def test_substitution(self): + result = self.template.build(week=10, maconomyurl="http://localhost/", helpurl="http://example.com") + self.assertIn("week 10", result) + self.assertIn("href=\"http://localhost/\"", result) + self.assertIn("href=\"http://example.com\"", result) + +class MissingEmailTemplateTest(unittest.TestCase): + + def setUp(self): + self.template = MissingEmailTemplate() + + def test_substitution(self): + result = self.template.build(maconomyurl="http://localhost/", helpurl="http://example.com") + self.assertIn("href=\"http://localhost/\"", result) + self.assertIn("href=\"http://example.com\"", result) + +class ManagerEmailTemplateTest(unittest.TestCase): + + def setUp(self): + self.template = ManagerEmailTemplate() + self.employee = Employee(("MK", "Markus Krogh", "markus@nordu.net")) + + def test_substitute(self): + result = self.template.build( + employee=self.employee, + week=11, + maconomyurl="http://localhost/", + ) + self.assertIn("Markus Krogh (MK)", result) + self.assertIn("Week 11", result) + self.assertIn("not been submitted", result) + self.assertIn("not been approved", result) + self.assertIn("href=\"http://localhost/\"", result) + + def test_submitted(self): + result = self.template.build( + employee=self.employee, + week=11, + maconomyurl="http://localhost/", + submitted = True, + ) + self.assertIn("has been submitted", result) + def test_approved(self): + result = self.template.build( + employee=self.employee, + week=11, + maconomyurl="http://localhost/", + approved = True, + ) + self.assertIn("has been approved", result) + + + |