示例#1
0
文件: api.py 项目: vishnu-rai/OpenCue
def getOwner(id):
    """Return an Owner object from the ID or name.

    :type  id: str
    :param id: a unique owner identifier or name
    :rtype:  Owner
    :return: An Owner object"""
    return Owner(Cuebot.getStub('owner').GetOwner(
        host_pb2.OwnerGetOwnerRequest(name=id), timeout=Cuebot.Timeout).owner)
示例#2
0
    def getOwner(self, name):
        """Return an owner by name.

        :type:   str
        :param:  Name of the owner
        :rtype:  opencue.wrappers.owner.Owner
        :return: Owner that matches the specified name"""
        return Owner(self.stub.GetOwner(host_pb2.OwnerGetOwnerRequest(name=name),
                                        timeout=Cuebot.Timeout).owner)
示例#3
0
 def getOwner(self, name):
     """Return an owner by name.
     @type:   str
     @param:  Name of the owner
     @rtype:  Owner
     @return: Owner that matches the specified name"""
     return Owner(
         self.stub.GetOwner(host_pb2.OwnerGetOwnerRequest(name=name),
                            timeout=Cuebot.Timeout).owner)
示例#4
0
    def testGetOwner(self, getStubMock):
        ownerName = 'arbitrary-name'
        stubMock = mock.Mock()
        stubMock.GetOwner.return_value = host_pb2.OwnerGetOwnerResponse(
            owner=host_pb2.Owner(name=ownerName))
        getStubMock.return_value = stubMock

        owner = opencue.api.getOwner(ownerName)

        stubMock.GetOwner.assert_called_with(
            host_pb2.OwnerGetOwnerRequest(name=ownerName), timeout=mock.ANY)
        self.assertEqual(ownerName, owner.name())
示例#5
0
    def testGetOwner(self, getStubMock):
        stubMock = mock.Mock()
        stubMock.GetOwner.return_value = host_pb2.OwnerGetOwnerResponse(
            owner=host_pb2.Owner(id=TEST_OWNER_ID, name=TEST_OWNER_NAME))
        getStubMock.return_value = stubMock

        owner = opencue.wrappers.owner.Owner()
        response = owner.getOwner(TEST_OWNER_NAME)

        stubMock.GetOwner.assert_called_with(
            host_pb2.OwnerGetOwnerRequest(name=TEST_OWNER_NAME), timeout=mock.ANY)
        self.assertEqual(response.id(), TEST_OWNER_ID)
        self.assertEqual(response.name(), TEST_OWNER_NAME)
示例#6
0
def getOwner(id):
    """Return an Owner object from the id or name."""
    return Cuebot.getStub('owner').GetOwner(
        host_pb2.OwnerGetOwnerRequest(name=id), timeout=Cuebot.Timeout).owner