def test__getShiftsByPerson_true(self): key = 3 shiftPersonList = shiftperson_controller._getShiftsByPerson(key) self.assertIsNotNone(shiftPersonList) self.assertEqual(shiftPersonList.count(), 3) counter = 0 for shiftPerson in shiftPersonList: counter += 1 self.assertTrue(shiftPerson.pk == 1 or shiftPerson.pk == 5 or shiftPerson.pk == 7) control = models.ShiftPerson.query.filter_by(pk=shiftPerson.pk).first() self.assertEqual(shiftPerson.__repr__(), control.__repr__()) self.assertEqual(counter, 3)
def test__getShiftsByPerson_false(self): key = 9999 shiftPersonList = shiftperson_controller._getShiftsByPerson(key) self.assertEqual(shiftPersonList.count(), 0)