コード例 #1
0
ファイル: tests.py プロジェクト: pistatium/kitimer
    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
ファイル: tests.py プロジェクト: pistatium/kitimer
    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
ファイル: tests.py プロジェクト: pistatium/kitimer
    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)