def setHardwareState(self, state): """Sets the host's hardware state @type state: host_pb2.HardwareState @param state: state to set host to""" self.stub.SetHardwareState(host_pb2.HostSetHardwareStateRequest( host=self.data, state=state), timeout=Cuebot.Timeout)
def testSetHardwareState(self, getStubMock): stubMock = mock.Mock() stubMock.SetHardwareState.return_value = host_pb2.HostSetHardwareStateResponse( ) getStubMock.return_value = stubMock state = host_pb2.REBOOTING host = opencue.wrappers.host.Host(host_pb2.Host(name=TEST_HOST_NAME)) host.setHardwareState(state) stubMock.SetHardwareState.assert_called_with( host_pb2.HostSetHardwareStateRequest(host=host.data, state=state), timeout=mock.ANY)