2019-03-31 00:40:01 +01:00
|
|
|
from lbrynet.testcase import CommandTestCase
|
|
|
|
|
|
|
|
|
|
|
|
class TestClaimtrie(CommandTestCase):
|
|
|
|
|
|
|
|
def get_claim_id(self, tx):
|
|
|
|
return tx['outputs'][0]['claim_id']
|
|
|
|
|
|
|
|
async def assertWinningClaim(self, name, tx):
|
2019-04-29 06:38:58 +02:00
|
|
|
other = (await self.out(self.daemon.jsonrpc_claim_search(name=name, is_controlling=True)))['items'][0]
|
2019-03-31 00:40:01 +01:00
|
|
|
self.assertEqual(self.get_claim_id(tx), other['claim_id'])
|
|
|
|
|
|
|
|
async def test_designed_edge_cases(self):
|
|
|
|
tx1 = await self.channel_create('@foo', allow_duplicate_name=True)
|
|
|
|
await self.assertWinningClaim('@foo', tx1)
|
|
|
|
tx2 = await self.channel_create('@foo', allow_duplicate_name=True)
|
|
|
|
await self.assertWinningClaim('@foo', tx1)
|
|
|
|
tx3 = await self.channel_create('@foo', allow_duplicate_name=True)
|
|
|
|
await self.assertWinningClaim('@foo', tx1)
|
|
|
|
await self.support_create(self.get_claim_id(tx3), '0.09')
|
|
|
|
await self.assertWinningClaim('@foo', tx3)
|
|
|
|
await self.support_create(self.get_claim_id(tx2), '0.19')
|
|
|
|
await self.assertWinningClaim('@foo', tx2)
|
|
|
|
await self.support_create(self.get_claim_id(tx1), '0.19')
|
|
|
|
await self.assertWinningClaim('@foo', tx1)
|