From ad492a09f76cc13217cd167073b5f2a87119a133 Mon Sep 17 00:00:00 2001 From: hackrush Date: Thu, 20 Sep 2018 23:25:04 +0530 Subject: [PATCH] Added integration tests and other review fixes --- lbrynet/daemon/Daemon.py | 4 +-- tests/integration/wallet/test_commands.py | 34 ++++++++++++++++++++++- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/lbrynet/daemon/Daemon.py b/lbrynet/daemon/Daemon.py index c277b84b2..9526fc460 100644 --- a/lbrynet/daemon/Daemon.py +++ b/lbrynet/daemon/Daemon.py @@ -2333,13 +2333,13 @@ class Daemon(AuthJSONRPCServer): Usage: claim_abandon [ | --claim_id=] [ | --txid=] [ | --nout=] - [--account_id=] + [--account=] Options: --claim_id= : (str) claim_id of the claim to abandon --txid= : (str) txid of the claim to abandon --nout= : (int) nout of the claim to abandon - --account_id= : (str) id of the account to use + --account= : (str) id of the account to use Returns: (dict) Dictionary containing result of the claim diff --git a/tests/integration/wallet/test_commands.py b/tests/integration/wallet/test_commands.py index 303cac389..7aebc9bf0 100644 --- a/tests/integration/wallet/test_commands.py +++ b/tests/integration/wallet/test_commands.py @@ -298,7 +298,7 @@ class EpicAdventuresOfChris45(CommandTestCase): self.assertTrue(abandon['success']) yield self.d_confirm_tx(abandon['tx']['txid']) - # And now check that the claim doesn't resolve anymore. + # And now checks that the claim doesn't resolve anymore. response = yield self.out(self.daemon.jsonrpc_resolve(uri='lbry://@spam/hovercraft')) self.assertNotIn('claim', response['lbry://@spam/hovercraft']) @@ -385,6 +385,38 @@ class EpicAdventuresOfChris45(CommandTestCase): self.assertEqual(resolve_result[uri]['claim']['supports'][2]['txid'], tx['txid']) yield self.d_generate(5) + # Now Ramsey who is a singer by profession, is preparing for his new "gig". He has everything in place for that + # the instruments, the theatre, the ads, everything, EXCEPT lyrics!! He panicked.. But then he remembered + # something, so he un-panicked. He quickly calls up his best bud Chris and requests him to write hit lyrics for + # his song, seeing as his novel had smashed all the records, he was the perfect candidate! + # ....... + # Chris agrees.. 17 hours 43 minutes and 14 seconds later, he makes his publish + with tempfile.NamedTemporaryFile() as file: + file.write(b'The Whale amd The Bookmark') + file.write(b'I know right? Totally a hit song') + file.write(b'That\'s what goes around for songs these days anyways') + file.flush() + claim4 = yield self.out(self.daemon.jsonrpc_publish( + 'hit-song', 1, file_path=file.name, channel_name='@spam', channel_id=channel['claim_id'] + )) + self.assertTrue(claim4['success']) + yield self.d_confirm_tx(claim4['tx']['txid']) + + yield self.d_generate(5) + + # He sends the link to Ramsey, all happy and proud + uri = 'lbry://@spam/hit-song' + + # But sadly Ramsey wasn't so pleased. It was hard for him to tell Chris... + # Chris, though a bit heartbroken, abandoned the claim for now, but instantly started working on new hit lyrics + abandon = yield self.out(self.daemon.jsonrpc_claim_abandon(txid=claim4['tx']['txid'], nout=0)) + self.assertTrue(abandon['success']) + yield self.d_confirm_tx(abandon['tx']['txid']) + + # He them checks that the claim doesn't resolve anymore. + response = yield self.out(self.daemon.jsonrpc_resolve(uri=uri)) + self.assertNotIn('claim', response[uri]) + class AccountManagement(CommandTestCase):