コード例 #1
0
    def test_shift_stores_in_database(self):
        user_id = 1
        start_time = now().replace(microsecond=0)
        end_time = start_time + timedelta(hours=1)

        shift = Shift(user_id, start_time, end_time, job_name='dd')
        shift.save_to_database()

        temp_shift = Shift.query.get(shift.id)

        self.assertEqual(temp_shift.start_time, shift.start_time)

        db.session.delete(shift)
        db.session.commit()
コード例 #2
0
 def setUp(self):
     db.create_all()
     self.week_start = now().replace(hour=5, minute=0, second=0, microsecond=0)
     self.week_end = self.week_start.replace(hour=10)