From f33f7aa642f612ef41d72352af89eeb7615664e6 Mon Sep 17 00:00:00 2001 From: Oskar Hladky Date: Wed, 27 Jun 2018 12:59:29 +0200 Subject: [PATCH] usage of bundle hash by find_transactions --- iota/api.py | 6 ++--- iota/commands/core/find_transactions.py | 4 ++-- test/commands/core/find_transactions_test.py | 24 ++++++++++---------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/iota/api.py b/iota/api.py index c451791..741c6d4 100644 --- a/iota/api.py +++ b/iota/api.py @@ -7,7 +7,7 @@ from six import with_metaclass from iota import AdapterSpec, Address, ProposedTransaction, Tag, \ - TransactionHash, TransactionTrytes, TryteString, TrytesCompatible + BundleHash, TransactionHash, TransactionTrytes, TryteString, TrytesCompatible from iota.adapter import BaseAdapter, resolve_adapter from iota.commands import BaseCommand, CustomCommand, core, \ discover_commands, extended @@ -242,7 +242,7 @@ def check_consistency(self, tails): def find_transactions( self, - bundles=None, # type: Optional[Iterable[TransactionHash]] + bundles=None, # type: Optional[Iterable[BundleHash]] addresses=None, # type: Optional[Iterable[Address]] tags=None, # type: Optional[Iterable[Tag]] approvees=None, # type: Optional[Iterable[TransactionHash]] @@ -260,7 +260,7 @@ def find_transactions( the values. :param bundles: - List of transaction IDs. + List of bundle IDs. :param addresses: List of addresses. diff --git a/iota/commands/core/find_transactions.py b/iota/commands/core/find_transactions.py index a8411fb..6bcd66a 100644 --- a/iota/commands/core/find_transactions.py +++ b/iota/commands/core/find_transactions.py @@ -5,7 +5,7 @@ import filters as f from six import iteritems -from iota import Tag, TransactionHash +from iota import Tag, TransactionHash, BundleHash from iota.commands import FilterCommand, RequestFilter, ResponseFilter from iota.filters import AddressNoChecksum, Trytes @@ -56,7 +56,7 @@ def __init__(self): 'bundles': f.Array | f.FilterRepeater( f.Required | - Trytes(TransactionHash) | + Trytes(BundleHash) | f.Unicode(encoding='ascii', normalize=False), ), diff --git a/test/commands/core/find_transactions_test.py b/test/commands/core/find_transactions_test.py index efb431f..960b72b 100644 --- a/test/commands/core/find_transactions_test.py +++ b/test/commands/core/find_transactions_test.py @@ -8,7 +8,7 @@ from filters.test import BaseFilterTestCase from six import text_type -from iota import Address, Iota, Tag, TransactionHash, TryteString +from iota import Address, Iota, Tag, BundleHash, TransactionHash, TryteString from iota.adapter import MockAdapter from iota.commands.core.find_transactions import FindTransactionsCommand, \ FindTransactionsRequestFilter @@ -36,8 +36,8 @@ def test_pass_all_parameters(self): # Raw trytes are extracted to match the IRI's JSON protocol. request = { 'bundles': [ - text_type(TransactionHash(self.trytes1)), - text_type(TransactionHash(self.trytes2)), + text_type(BundleHash(self.trytes1)), + text_type(BundleHash(self.trytes2)), ], 'addresses': [ @@ -69,7 +69,7 @@ def test_pass_compatible_types(self): filter_ = self._filter({ 'bundles': [ self.trytes1.encode('ascii'), - TransactionHash(self.trytes2), + BundleHash(self.trytes2), ], 'addresses': [ @@ -95,8 +95,8 @@ def test_pass_compatible_types(self): { # Raw trytes are extracted to match the IRI's JSON protocol. 'bundles': [ - text_type(TransactionHash(self.trytes1)), - text_type(TransactionHash(self.trytes2)), + text_type(BundleHash(self.trytes1)), + text_type(BundleHash(self.trytes2)), ], 'addresses': [ @@ -122,8 +122,8 @@ def test_pass_bundles_only(self): """ request = { 'bundles': [ - TransactionHash(self.trytes1), - TransactionHash(self.trytes2), + BundleHash(self.trytes1), + BundleHash(self.trytes2), ], } @@ -135,8 +135,8 @@ def test_pass_bundles_only(self): { 'bundles': [ - text_type(TransactionHash(self.trytes1)), - text_type(TransactionHash(self.trytes2)), + text_type(BundleHash(self.trytes1)), + text_type(BundleHash(self.trytes2)), ], # Null criteria are not included in the request. @@ -292,7 +292,7 @@ def test_fail_unexpected_parameters(self): { 'addresses': [Address(self.trytes1)], 'approvees': [TransactionHash(self.trytes1)], - 'bundles': [TransactionHash(self.trytes1)], + 'bundles': [BundleHash(self.trytes1)], 'tags': [Tag(self.trytes1)], # Hey, you're not allowed in he-argh! @@ -310,7 +310,7 @@ def test_fail_bundles_wrong_type(self): """ self.assertFilterErrors( { - 'bundles': TransactionHash(self.trytes1), + 'bundles': BundleHash(self.trytes1), }, {