Exemple #1
0
    def test_left(self):
        manager = TimeManager(self.user)
        manager.left(self.LEFT_AT)

        day_log = DayLog.find_or_create(self.user, self.LEFT_AT.date())
        timer_logs = TimerLog.findAll(self.user, self.LEFT_AT.date())

        self.assertEqual(day_log.left_at, self.LEFT_AT)
        self.assertEqual(len(timer_logs), 1)
        self.assertEqual(timer_logs[0].action_type, TimerLog.LEFT)
        self.assertEqual(timer_logs[0].time, self.LEFT_AT)
Exemple #2
0
    def test_arrived(self):
        manager = TimeManager(self.user)
        manager.arrived(self.ARRIVED_AT)

        day_log = DayLog.find_or_create(self.user, self.ARRIVED_AT.date())
        timer_logs = TimerLog.findAll(self.user, self.ARRIVED_AT.date())

        self.assertEqual(day_log.arrived_at, self.ARRIVED_AT)
        self.assertEqual(len(timer_logs), 1)
        self.assertEqual(timer_logs[0].action_type, TimerLog.ARRIVED)
        self.assertEqual(timer_logs[0].time, self.ARRIVED_AT)
Exemple #3
0
    def test_left(self):
        manager = TimeManager(self.user)
        manager.left(self.LEFT_AT)

        day_log = DayLog.find_or_create(self.user, self.LEFT_AT.date())
        timer_logs = TimerLog.findAll(self.user, self.LEFT_AT.date())

        self.assertEqual(day_log.left_at, self.LEFT_AT)
        self.assertEqual(len(timer_logs), 1)
        self.assertEqual(timer_logs[0].action_type, TimerLog.LEFT)
        self.assertEqual(timer_logs[0].time, self.LEFT_AT)
Exemple #4
0
    def test_arrived(self):
        manager = TimeManager(self.user)
        manager.arrived(self.ARRIVED_AT)

        day_log = DayLog.find_or_create(self.user, self.ARRIVED_AT.date())
        timer_logs = TimerLog.findAll(self.user, self.ARRIVED_AT.date())

        self.assertEqual(day_log.arrived_at, self.ARRIVED_AT)
        self.assertEqual(len(timer_logs), 1)
        self.assertEqual(timer_logs[0].action_type, TimerLog.ARRIVED)
        self.assertEqual(timer_logs[0].time, self.ARRIVED_AT)
Exemple #5
0
    def test_arrive_and_left(self):
        manager = TimeManager(self.user)
        manager.arrived(self.ARRIVED_AT)
        manager.left(self.LEFT_AT)

        day_log = DayLog.find_or_create(self.user, self.ARRIVED_AT.date())
        timer_logs = TimerLog.findAll(self.user, self.ARRIVED_AT.date())

        self.assertEqual(day_log.arrived_at, self.ARRIVED_AT)
        self.assertEqual(day_log.left_at, self.LEFT_AT)
        self.assertEqual(day_log.work_time, 520)
        self.assertEqual(len(timer_logs), 2)
Exemple #6
0
    def test_arrive_and_left(self):
        manager = TimeManager(self.user)
        manager.arrived(self.ARRIVED_AT)
        manager.left(self.LEFT_AT)

        day_log = DayLog.find_or_create(self.user, self.ARRIVED_AT.date())
        timer_logs = TimerLog.findAll(self.user, self.ARRIVED_AT.date())

        self.assertEqual(day_log.arrived_at, self.ARRIVED_AT)
        self.assertEqual(day_log.left_at, self.LEFT_AT)
        self.assertEqual(day_log.work_time, 520)
        self.assertEqual(len(timer_logs), 2)