示例#1
0
文件: api.py 项目: vishnu-rai/OpenCue
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)
示例#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())
示例#3
0
def getAllocation(allocId):
    return Allocation(
        Cuebot.getStub('allocation').Get(
            facility_pb2.AllocGetRequest(id=allocId),
            timeout=Cuebot.Timeout).allocation)