summaryrefslogtreecommitdiff
path: root/test/views/test_employee_email.py
blob: 75ebbd6f66c3cbccc4564acdb4acf68354c49912 (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
from maconomy import EmployeeEmailView, Timesheet
from ConfigParser import SafeConfigParser
import unittest

class EmployeeEmailViewTest(unittest.TestCase):
    def setUp(self):
        self.config = SafeConfigParser()
        self.config.add_section("view")
        self.config.set("view", "maconomyurl", "http://localhost/maconomy")
        self.config.set("view", "helpurl", "http://localhost/help")
        self.view = EmployeeEmailView(self.config)
        self.timesheet = Timesheet.from_result(("Markus Krogh", "MK", "markus@nordu.net", 11, 0, 0, "JK"))

    def test_missing_timereg(self):
        self.timesheet.submitted=None
        result = self.view.render(self.timesheet)
        self.assertIn("href=\"http://localhost/maconomy\"", result)
        self.assertIn("href=\"http://localhost/help\"", result)

    def test_unsubmitted_timereg(self):
        self.timesheet.submitted=0
        result = self.view.render(self.timesheet)
        self.assertIn("week 11", result)
        self.assertIn("href=\"http://localhost/maconomy\"", result)
        self.assertIn("href=\"http://localhost/help\"", result)