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)
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)
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)
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())
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)
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