summaryrefslogtreecommitdiff
path: root/test/templates/test_manager_template.py
blob: bdc7387dfe7bc7804a0923f9becd7d5e261e4389 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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)