Exemple #1
0
 def setAllocation(self, allocation):
     """Sets the host to the given allocation
     @type allocation: Allocation
     @param allocation: An allocation object
     """
     self.stub.SetAllocation(host_pb2.HostSetAllocationRequest(
         host=self.data, allocation_name=allocation.id()),
                             timeout=Cuebot.Timeout)
Exemple #2
0
    def setAllocation(self, allocation):
        """Sets the host to the given allocation.

        :type  allocation: opencue.wrappers.allocation.Allocation
        :param allocation: allocation to put the host under
        """
        self.stub.SetAllocation(host_pb2.HostSetAllocationRequest(
            host=self.data, allocation_id=allocation.id()),
                                timeout=Cuebot.Timeout)
Exemple #3
0
    def testSetAllocation(self, getStubMock):
        stubMock = mock.Mock()
        stubMock.SetAllocation.return_value = host_pb2.HostSetAllocationResponse()
        getStubMock.return_value = stubMock

        allocId = 'aaa-aaaa-aaa'
        alloc = opencue.wrappers.allocation.Allocation(facility_pb2.Allocation(id=allocId))
        host = opencue.wrappers.host.Host(
            host_pb2.Host(name=TEST_HOST_NAME))
        host.setAllocation(alloc)

        stubMock.SetAllocation.assert_called_with(
            host_pb2.HostSetAllocationRequest(host=host.data, allocation_id=alloc.id()),
            timeout=mock.ANY)