def test__removeShift_true(self):
     # Define the values we're going to have to add for the test.
     newShift = models.Shift()
     newShift.eventFK = 1
     newShift.startdatetime = datetime.datetime(2013,7,28,16,0)
     newShift.enddatetime = datetime.datetime(2013,7,28,17,0)
     newShift.location = 'Booth C.5'
     newShift.minWorkers = 24
     newShift.maxWorkers = 42
     
     # Ensure it's not already in db.
     result = shifts_controller._isDuplicateShift(newShift)
     self.assertFalse(result)
     
     # Add it to db
     newShiftPK = shifts_controller._insertShift(newShift, self.db)
     self.assertTrue(newShiftPK > 0)
     
     # Ensure it's in db.
     result = shifts_controller._isDuplicateShift(newShift)
     self.assertTrue(result)
     
     # Now that we added it, lets delete it.
     result = shifts_controller._removeShift(newShiftPK, self.db)
     self.assertTrue(result)
     
     # Ensure it's not in db.
     result = shifts_controller._isDuplicateShift(newShift)
     self.assertFalse(result)
 def test__removeShift_invalid(self):
     # Define the values we're going to have to add for the test.
     newShift = models.Shift()
     newShift.eventFK = 1
     newShift.startdatetime = datetime.datetime(2013,7,28,16,0)
     newShift.enddatetime = datetime.datetime(2013,7,28,17,0)
     newShift.location = 'Booth C.5'
     newShift.minWorkers = 24
     newShift.maxWorkers = 42
     
     # Ensure it's not already in db.
     result = shifts_controller._isDuplicateShift(newShift)
     self.assertFalse(result)
     
     # Try to delete it even though we know it's not there
     result = shifts_controller._removeShift(newShift.pk, self.db)
     self.assertFalse(result)
 def test__removeShift_false(self):
     # Try to delete a record that's not there
     result = shifts_controller._removeShift(9999999, self.db)
     self.assertFalse(result)