def getDeeds(self): """Return the list of deeds for the owner. :rtype: List<opencue.wrappers..deed.Deed Wrapper> :return: The list of deeds associated with this owner.""" response = self.stub.GetDeeds(host_pb2.OwnerGetDeedsRequest(owner=self.data), timeout=Cuebot.Timeout) return [opencue.wrappers.deed.Deed(deed) for deed in response.deeds.deeds]
def testGetDeeds(self, getStubMock): stubMock = mock.Mock() stubMock.GetDeeds.return_value = host_pb2.OwnerGetDeedsResponse( deeds=host_pb2.DeedSeq(deeds=[host_pb2.Deed(id=TEST_DEED_ID)])) getStubMock.return_value = stubMock owner = opencue.wrappers.owner.Owner( host_pb2.Owner(id=TEST_OWNER_ID, name=TEST_OWNER_NAME)) deeds = owner.getDeeds() stubMock.GetDeeds.assert_called_with( host_pb2.OwnerGetDeedsRequest(owner=owner.data), timeout=mock.ANY) self.assertEqual(len(deeds), 1) self.assertEqual(deeds[0].id(), TEST_DEED_ID)