def testAppointmentLoading(self): bob = new_worker() filled_appointments = [a for a in self.duration.appointments() if a.is_filled()] self.assertTrue(len(filled_appointments) == 0) loader = DurationSavingObject(self.duration, 'test_appointing_sheet.xls') loader.load([bob]) filled_appointments = [a for a in self.duration.appointments() if a.is_filled()] self.assertEqual(len(filled_appointments),3)
def testDurationDisabledAppointmentLoading(self): saver = DurationSavingObject(self.duration, 'temp_sheet.xls') saver.create() saver.populate() for a in self.duration.appointments(): a.disabled = False disabled_appointments = [a for a in self.duration.appointments() if a.disabled] self.assertTrue(len(disabled_appointments) == 0) loader = DurationSavingObject(self.duration, 'temp_sheet.xls') loader.load() disabled_appointments = [a for a in self.duration.appointments() if a.disabled] self.assertFalse(len(disabled_appointments) == 0)
def testDurationFilledAppointmentLoading(self): bob = new_worker() key_appointment = self.duration.events[1].appointments[2] key_appointment.appoint(bob) self.assertTrue(key_appointment.is_filled()) saver = DurationSavingObject(self.duration, 'temp_sheet.xls') saver.create() saver.populate() key_appointment.vacate() self.assertFalse(key_appointment.is_filled()) loader = DurationSavingObject(self.duration, 'temp_sheet.xls') loader.load([bob]) self.assertTrue(key_appointment.is_filled())