def test_check_valid_device_with_cmd_error(self): def raise_except(*args, **kwargs): raise putils.ProcessExecutionError self.connector = connector.InitiatorConnector(None) self.stubs.Set(self.connector, '_execute', raise_except) self.assertFalse(self.connector.check_valid_device('/dev'))
def test_check_valid_device_with_wrong_path(self): self.connector = connector.InitiatorConnector(None) self.stubs.Set(self.connector, '_execute', lambda *args, **kwargs: ("", None)) self.assertFalse(self.connector.check_valid_device('/d0v'))
def test_check_valid_device(self): self.connector = connector.InitiatorConnector(None) self.stubs.Set(self.connector, '_execute', lambda *args, **kwargs: ("", "")) self.assertTrue(self.connector.check_valid_device('/dev'))
def test_disconnect_volume(self): self.connector = connector.InitiatorConnector(None) self.assertRaises(NotImplementedError, self.connector.disconnect_volume, None, None)