summaryrefslogtreecommitdiff
path: root/test/templates/test_employee_status_template.py
blob: 9869b8169badd65b469bbe66dbdfd69ec8fe0e3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from maconomy import EmployeeStatusListTemplate, Employee, Timesheet
import unittest

class EmployeeStatusListTemplateTest(unittest.TestCase):

    def setUp(self):
        self.template = EmployeeStatusListTemplate()
        self.employee = Employee.from_result(("MK", "Markus Krogh", "markus@nordu.net"))

    def test_substitute(self):
        timesheets = [Timesheet("11", 0, 0, self.employee, "JK")]
        result = self.template.build(timesheets)
        self.assertIn("[Unsubmitted] Markus Krogh (MK)", result)

    def test_submitted(self):
        timesheets = [Timesheet("11", submitted=1, approved=0, employee=self.employee, approver="JK")]
        result = self.template.build(timesheets)
        self.assertIn("[Not approved] Markus Krogh (MK)", result)

    def test_approved(self):
        timesheets = [Timesheet("11", submitted=1, approved=1, employee=self.employee, approver="JK")]
        result = self.template.build(timesheets)
        self.assertIn("[OK] Markus Krogh (MK)", result)