Exemplo n.º 1
0
def getAllocation(allocId):
    """Returns the Allocation object that matches the ID.

    :type  allocId: str
    :param allocId: the ID of the allocation
    :rtype:  Allocation
    :return: an Allocation object"""
    return Allocation(Cuebot.getStub('allocation').Get(
        facility_pb2.AllocGetRequest(id=allocId), timeout=Cuebot.Timeout).allocation)
Exemplo n.º 2
0
    def testGetAlloc(self, getStubMock):
        arbitraryId = '00000000-0000-0000-0000-012345678980'
        stubMock = mock.Mock()
        stubMock.Get.return_value = facility_pb2.AllocGetResponse(
            allocation=facility_pb2.Allocation(id=arbitraryId))
        getStubMock.return_value = stubMock

        alloc = opencue.api.getAllocation(arbitraryId)

        stubMock.Get.assert_called_with(
            facility_pb2.AllocGetRequest(id=arbitraryId), timeout=mock.ANY)
        self.assertEqual(arbitraryId, alloc.id())
Exemplo n.º 3
0
def getAllocation(allocId):
    return Allocation(
        Cuebot.getStub('allocation').Get(
            facility_pb2.AllocGetRequest(id=allocId),
            timeout=Cuebot.Timeout).allocation)