Exemplo n.º 1
0
    def testBaseSearchHost(self, getStubMock):
        stubMock = mock.Mock()
        stubMock.GetHosts.return_value = host_pb2.HostGetHostsResponse()
        getStubMock.return_value = stubMock

        hostSearch = opencue.search.HostSearch(substr=['unittest_host'])
        hostSearch.search()

        stubMock.GetHosts.assert_called_with(host_pb2.HostGetHostsRequest(
            r=host_pb2.HostSearchCriteria(substr=['unittest_host'])),
                                             timeout=mock.ANY)
Exemplo n.º 2
0
    def testGetHosts(self, getStubMock):
        stubMock = mock.Mock()
        stubMock.GetHosts.return_value = host_pb2.HostGetHostsResponse(
            hosts=host_pb2.HostSeq(hosts=[host_pb2.Host(name=TEST_HOST_NAME)]))
        getStubMock.return_value = stubMock

        hosts = opencue.api.getHosts(name=[TEST_HOST_NAME])

        stubMock.GetHosts.assert_called_with(
            host_pb2.HostGetHostsRequest(r=host_pb2.HostSearchCriteria(hosts=[TEST_HOST_NAME])),
            timeout=mock.ANY)
        self.assertEqual(1, len(hosts))
        self.assertEqual(TEST_HOST_NAME, hosts[0].name())