def test__getPeopleByShift_true(self): key = 1 shiftPersonList = shiftperson_controller._getPeopleByShift(key) self.assertIsNotNone(shiftPersonList) self.assertEqual(shiftPersonList.count(), 2) counter = 0 for shiftPerson in shiftPersonList: counter += 1 self.assertTrue(shiftPerson.pk > 0 and shiftPerson.pk <= 2) control = models.ShiftPerson.query.filter_by(pk=shiftPerson.pk).first() self.assertEqual(shiftPerson.__repr__(), control.__repr__()) self.assertEqual(counter, 2)
def test__getPeopleByShift_false(self): key = 9999 shiftPersonList = shiftperson_controller._getPeopleByShift(key) self.assertEqual(shiftPersonList.count(), 0)