def test__getShiftsByEvent_true(self): key = 1 shiftList = shifts_controller._getShiftsByEvent(key) self.assertIsNotNone(shiftList) self.assertEqual(shiftList.count(), 4) counter = 0 for shift in shiftList: counter += 1 self.assertTrue(shift.pk > 0 and shift.pk <= 4) control = models.Shift.query.filter_by(pk=shift.pk).first() self.assertEqual(shift.__repr__(), control.__repr__()) self.assertEqual(counter, 4)
def test__getShiftsByEvent_false(self): key = 9999 shiftList = shifts_controller._getShiftsByEvent(key) self.assertEqual(shiftList.count(), 0)