def test_simple_functionality(self): data = "\n\nwhee\n" test_file = mock.SaveDataAfterCloseStringIO() base_utils.open.expect_call("filename", "w").and_return(test_file) base_utils.open_write_close("filename", data) self.god.check_playback() self.assertEqual(data, test_file.final_data)
def unbind_usb_drivers(self): """Unbinds the USB driver(s) of the current device from the host. This is applied to all the drivers associated with and listed under the USB device with the current _device_product_name and _device_bus_id. @raises: USBDeviceDriversManagerError if device bus ID for this instance has not been set yet. """ if self._device_bus_id is None: raise USBDeviceDriversManagerError('USB Bus ID is not set yet.') if not self.drivers_are_bound(): return base_utils.open_write_close(self._USB_UNBIND_FILE_PATH, self._device_bus_id)
def reset(self): """Resets HCD by unbinding and binding driver.""" base_utils.open_write_close(os.path.join(self._hcd_path, 'unbind'), self._hcd_id) base_utils.open_write_close(os.path.join(self._hcd_path, 'bind'), self._hcd_id)