예제 #1
0
 def getHosts(self):
     """Returns the list of hosts for this allocation.
     @rtype: list<opencue.wrappers.host.Host>
     @return: list of hosts
     """
     hostSeq = self.stub.GetHosts(facility_pb2.AllocGetHostsRequest(allocation=self.data),
                                  timeout=Cuebot.Timeout).hosts
     return [opencue.wrappers.host.Host(h) for h in hostSeq.hosts]
예제 #2
0
    def testGetHosts(self, getStubMock):
        stubMock = mock.Mock()
        stubMock.GetHosts.return_value = facility_pb2.AllocGetHostsResponse(
            hosts=host_pb2.HostSeq(hosts=[host_pb2.Host(name=TEST_HOST_NAME)]))
        getStubMock.return_value = stubMock

        alloc = opencue.wrappers.allocation.Allocation(
            facility_pb2.Allocation(name=TEST_ALLOC_NAME))
        hosts = alloc.getHosts()

        stubMock.GetHosts.assert_called_with(
            facility_pb2.AllocGetHostsRequest(allocation=alloc.data),
            timeout=mock.ANY)
        self.assertEqual(len(hosts), 1)
        self.assertEqual(hosts[0].name(), TEST_HOST_NAME)