def test__removeShiftPerson_true(self): # Define the values we're going to have to add for the test. shiftFK = 3 personFK = 4 newShiftPerson = models.ShiftPerson(shiftFK, personFK) # Ensure it's not already in db. result = shiftperson_controller._isDuplicateAssignment(newShiftPerson) self.assertFalse(result) # Add it to db newShiftPersonPK = shiftperson_controller._insertShiftPerson(newShiftPerson, self.db) self.assertTrue(newShiftPersonPK > 0) # Ensure it's in db. result = shiftperson_controller._isDuplicateAssignment(newShiftPerson) self.assertTrue(result) # Now that we added it, lets delete it. result = shiftperson_controller._removeShiftPerson(shiftFK, personFK, self.db) self.assertTrue(result) # Ensure it's not in db. result = shiftperson_controller._isDuplicateAssignment(newShiftPerson) self.assertFalse(result)
def test__removeShiftPerson_invalid(self): # Define the values we're going to have to add for the test. shiftFK = 3 personFK = 4 newShiftPerson = models.ShiftPerson(shiftFK, personFK) # Ensure it's not already in db. result = shiftperson_controller._isDuplicateAssignment(newShiftPerson) self.assertFalse(result) # Try to delete it even though we know it's not there result = shiftperson_controller._removeShiftPerson(shiftFK, personFK, self.db) self.assertFalse(result)
def test__removeShiftPerson_false(self): # Try to delete a record that's not there result = shiftperson_controller._removeShiftPerson(9999999, 9999999, self.db) self.assertFalse(result)