Exemplo n.º 1
0
def findHost(name):
    """Returns the host for the matching hostname.

    :type  name: str
    :param name: the unique name of a host
    :rtype:  Host
    :return: The matching host object"""
    return Host(Cuebot.getStub('host').FindHost(
        host_pb2.HostFindHostRequest(name=name), timeout=Cuebot.Timeout).host)
Exemplo n.º 2
0
    def testFindHost(self, getStubMock):
        stubMock = mock.Mock()
        stubMock.FindHost.return_value = host_pb2.HostFindHostResponse(
            host=host_pb2.Host(name=TEST_HOST_NAME))
        getStubMock.return_value = stubMock

        host = opencue.api.findHost(TEST_HOST_NAME)

        stubMock.FindHost.assert_called_with(
            host_pb2.HostFindHostRequest(name=TEST_HOST_NAME), timeout=mock.ANY)
        self.assertEqual(TEST_HOST_NAME, host.name())