def test_send_file_failed_to_send(self): self._return_reserved() file_content = "SAMPLE CONTENT" file_info = "program" self.lab_mock.send_file(SessionId.SessionId('my_lab_session_id'), file_content, file_info) self.mocker.throw( LaboratoryErrors.FailedToInteractError("problem@laboratory")) self.mocker.replay() self.create_reservation_processor() self.coordinator.confirmer._confirm_handler.join(10) self.assertFalse(self.coordinator.confirmer._confirm_handler.isAlive()) self.reservation_processor.get_status() self.assertFalse(self.reservation_processor.is_expired()) self.assertRaises(coreExc.FailedToInteractError, self.reservation_processor.send_file, file_content, file_info) self.assertEquals(self.reservation_processor.get_status().status, Reservation.Reservation.POST_RESERVATION)
def test_send_command_failed_to_send(self): self._return_reserved() command = Command.Command("Your command") self.lab_mock.send_command(SessionId.SessionId('my_lab_session_id'), command) self.mocker.throw( LaboratoryErrors.FailedToInteractError("problem@laboratory")) self.mocker.replay() self.create_reservation_processor() self.coordinator.confirmer._confirm_handler.join(10) self.assertFalse(self.coordinator.confirmer._confirm_handler.isAlive()) self.reservation_processor.get_status() self.assertFalse(self.reservation_processor.is_expired()) self.assertRaises(coreExc.FailedToInteractError, self.reservation_processor.send_command, command) self.assertEquals(self.reservation_processor.get_status().status, Reservation.Reservation.POST_RESERVATION)