示例#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)
示例#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)
示例#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)
示例#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)
示例#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)
示例#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)