summaryrefslogtreecommitdiff
path: root/test/templates/test_manager_template.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/templates/test_manager_template.py')
-rw-r--r--test/templates/test_manager_template.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/templates/test_manager_template.py b/test/templates/test_manager_template.py
new file mode 100644
index 0000000..bdc7387
--- /dev/null
+++ b/test/templates/test_manager_template.py
@@ -0,0 +1,39 @@
+from maconomy import ManagerEmailTemplate, Employee, Timesheet
+import unittest
+
+class ManagerEmailTemplateTest(unittest.TestCase):
+ def setUp(self):
+ self.template = ManagerEmailTemplate()
+ self.not_approved = Timesheet.from_result(("MK", "Markus Krogh", "markus@nordu.net", "11", 1, 0, "JK"))
+ self.not_submitted = Timesheet.from_result(("MKR", "Markus Krogh", "markus@nordu.net", "11", 0, 0, "JK"))
+
+ def test_not_approved(self):
+ result = self.template.build(
+ timesheets=[self.not_approved],
+ maconomyurl="http://localhost/")
+ self.assertIn("Markus Krogh (MK)", result)
+ self.assertIn("has not been approved", result)
+ self.assertIn("has been submitted", result)
+ self.assertIn("href=\"http://localhost/\"", result)
+
+ def test_not_submitted(self):
+ result = self.template.build(
+ timesheets=[self.not_submitted],
+ maconomyurl="http://localhost/")
+ self.assertIn("Markus Krogh (MKR)", result)
+ self.assertIn("has not been approved", result)
+ self.assertIn("has not been submitted", result)
+ self.assertIn("href=\"http://localhost/\"", result)
+
+ def test_multiple_timesheets(self):
+ result = self.template.build(
+ timesheets=[self.not_submitted, self.not_approved],
+ maconomyurl="http://localhost/")
+
+ self.assertIn("Markus Krogh (MKR)", result)
+ self.assertIn("Markus Krogh (MK)", result)
+ self.assertIn("has not been approved", result)
+ self.assertIn("has been submitted", result)
+ self.assertIn("has not been submitted", result)
+ self.assertIn("href=\"http://localhost/\"", result)
+