summaryrefslogtreecommitdiff
path: root/test/templates/test_manager_template.py
blob: d650eb9e29f2079c2ca03b1c9b5b41568615e5f7 (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
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("[Not approved] Markus Krogh (MK)", 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("[Unsubmitted] Markus Krogh (MKR)", 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("[Unsubmitted] Markus Krogh (MKR)", result)
        self.assertIn("[Not approved] Markus Krogh (MK)", result)
        self.assertIn("href=\"http://localhost/\"", result)