fix for claim_list incorrectly handling --is_spent flag

This commit is contained in:
Lex Berezhny 2020-04-22 10:36:09 -04:00
parent 51f573f1ea
commit 9a6326b027
2 changed files with 5 additions and 2 deletions

View file

@ -2237,7 +2237,7 @@ class Daemon(metaclass=JSONRPCServerType):
Returns: {Paginated[Output]}
"""
kwargs['type'] = claim_type or CLAIM_TYPE_NAMES
if 'is_spent' not in kwargs:
if not kwargs.get('is_spent', False):
kwargs['is_not_spent'] = True
return self.jsonrpc_txo_list(**kwargs)

View file

@ -661,12 +661,15 @@ class ClaimCommands(ClaimTestCase):
channel_id = self.get_claim_id(await self.channel_create())
stream_id = self.get_claim_id(await self.stream_create())
await self.stream_update(stream_id, title='foo')
# type filtering
r = await self.claim_list(claim_type='channel')
self.assertEqual(1, len(r))
self.assertEqual('channel', r[0]['value_type'])
r = await self.claim_list(claim_type='stream')
# catch a bug where cli sends is_spent=False by default
r = await self.claim_list(claim_type='stream', is_spent=False)
self.assertEqual(1, len(r))
self.assertEqual('stream', r[0]['value_type'])