fix bug in collection_update --replace

This commit is contained in:
zeppi 2021-05-14 12:25:40 -04:00 committed by Victor Shyba
parent 09339c9cfb
commit 2b950ff5dd
2 changed files with 3 additions and 5 deletions

View file

@ -3938,9 +3938,6 @@ class Daemon(metaclass=JSONRPCServerType):
if replace: if replace:
claim = Claim() claim = Claim()
claim.collection.message.source.CopyFrom(
old_txo.claim.collection.message.source
)
claim.collection.update(**kwargs) claim.collection.update(**kwargs)
else: else:
claim = Claim.from_bytes(old_txo.claim.to_bytes()) claim = Claim.from_bytes(old_txo.claim.to_bytes())

View file

@ -2169,7 +2169,7 @@ class CollectionCommands(CommandTestCase):
tx = await self.collection_create('radjingles', claims=claim_ids, allow_duplicate_name=True) tx = await self.collection_create('radjingles', claims=claim_ids, allow_duplicate_name=True)
claim_id2 = self.get_claim_id(tx) claim_id2 = self.get_claim_id(tx)
self.assertItemCount(await self.daemon.jsonrpc_collection_list(), 2) self.assertItemCount(await self.daemon.jsonrpc_collection_list(), 2)
# with clear_claims
await self.collection_update(claim_id, clear_claims=True, claims=claim_ids[:2]) await self.collection_update(claim_id, clear_claims=True, claims=claim_ids[:2])
collections = await self.out(self.daemon.jsonrpc_collection_list()) collections = await self.out(self.daemon.jsonrpc_collection_list())
self.assertEquals(len(collections['items']), 2) self.assertEquals(len(collections['items']), 2)
@ -2177,7 +2177,8 @@ class CollectionCommands(CommandTestCase):
resolved_collections = await self.out(self.daemon.jsonrpc_collection_list(resolve=True)) resolved_collections = await self.out(self.daemon.jsonrpc_collection_list(resolve=True))
self.assertIn('canonical_url', resolved_collections['items'][0]) self.assertIn('canonical_url', resolved_collections['items'][0])
# with replace
# TODO
await self.collection_abandon(claim_id) await self.collection_abandon(claim_id)
self.assertItemCount(await self.daemon.jsonrpc_collection_list(), 1) self.assertItemCount(await self.daemon.jsonrpc_collection_list(), 1)