Merge pull request #5583

77594c4f functional_tests: fix python3 compatibility (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2019-06-01 20:27:41 +02:00
commit 51766d026b
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD
15 changed files with 60 additions and 59 deletions

View file

@ -28,6 +28,7 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from __future__ import print_function
import time import time
"""Test peer baning RPC calls """Test peer baning RPC calls
@ -42,7 +43,7 @@ from framework.daemon import Daemon
class BanTest(): class BanTest():
def run_test(self): def run_test(self):
print 'Testing bans' print('Testing bans')
daemon = Daemon() daemon = Daemon()
res = daemon.get_bans() res = daemon.get_bans()

View file

@ -28,6 +28,7 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from __future__ import print_function
import time import time
"""Test daemon blockchain RPC calls """Test daemon blockchain RPC calls
@ -50,7 +51,7 @@ class BlockchainTest():
self._test_alt_chains() self._test_alt_chains()
def reset(self): def reset(self):
print 'Resetting blockchain' print('Resetting blockchain')
daemon = Daemon() daemon = Daemon()
daemon.pop_blocks(1000) daemon.pop_blocks(1000)
daemon.flush_txpool() daemon.flush_txpool()
@ -58,7 +59,7 @@ class BlockchainTest():
def _test_generateblocks(self, blocks): def _test_generateblocks(self, blocks):
assert blocks >= 2 assert blocks >= 2
print "Test generating", blocks, 'blocks' print("Test generating", blocks, 'blocks')
daemon = Daemon() daemon = Daemon()
@ -182,14 +183,14 @@ class BlockchainTest():
for idx in tx.output_indices: for idx in tx.output_indices:
assert idx == running_output_index assert idx == running_output_index
running_output_index += 1 running_output_index += 1
res_out = daemon.get_outs([{'amount': 0, 'index': i} for i in tx.output_indices], get_txid = True) res_out = daemon.get_outs([{'amount': 0, 'index': idx} for idx in tx.output_indices], get_txid = True)
assert len(res_out.outs) == len(tx.output_indices) assert len(res_out.outs) == len(tx.output_indices)
for out in res_out.outs: for out in res_out.outs:
assert len(out.key) == 64 assert len(out.key) == 64
assert len(out.mask) == 64 assert len(out.mask) == 64
assert not out.unlocked assert not out.unlocked
assert out.height == i + 1 assert out.height == i
assert out.txid == txids[i + 1] assert out.txid == txids[i]
for i in range(height + nblocks - 1): for i in range(height + nblocks - 1):
res_sum = daemon.get_coinbase_tx_sum(i, 1) res_sum = daemon.get_coinbase_tx_sum(i, 1)
@ -255,7 +256,7 @@ class BlockchainTest():
alt_blocks[i] = txid alt_blocks[i] = txid
nonce += 1 nonce += 1
print 'mining 3 on 1' print('mining 3 on 1')
# three more on [1] # three more on [1]
chain1 = [] chain1 = []
res = daemon.generateblocks('42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 3, prev_block = alt_blocks[1], starting_nonce = nonce) res = daemon.generateblocks('42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 3, prev_block = alt_blocks[1], starting_nonce = nonce)
@ -275,7 +276,7 @@ class BlockchainTest():
for txid in alt_blocks: for txid in alt_blocks:
assert txid in res.blks_hashes or txid == alt_blocks[1] assert txid in res.blks_hashes or txid == alt_blocks[1]
print 'mining 4 on 3' print('mining 4 on 3')
# 4 more on [3], the chain will reorg when we mine the 4th # 4 more on [3], the chain will reorg when we mine the 4th
top_block_hash = blk_hash top_block_hash = blk_hash
prev_block = alt_blocks[3] prev_block = alt_blocks[3]

View file

@ -28,11 +28,10 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import time
"""Test cold tx signing """Test cold tx signing
""" """
from __future__ import print_function
from framework.daemon import Daemon from framework.daemon import Daemon
from framework.wallet import Wallet from framework.wallet import Wallet
@ -44,13 +43,13 @@ class ColdSigningTest():
self.transfer() self.transfer()
def reset(self): def reset(self):
print 'Resetting blockchain' print('Resetting blockchain')
daemon = Daemon() daemon = Daemon()
daemon.pop_blocks(1000) daemon.pop_blocks(1000)
daemon.flush_txpool() daemon.flush_txpool()
def create(self, idx): def create(self, idx):
print 'Creating hot and cold wallet' print('Creating hot and cold wallet')
self.hot_wallet = Wallet(idx = 0) self.hot_wallet = Wallet(idx = 0)
# close the wallet if any, will throw if none is loaded # close the wallet if any, will throw if none is loaded
@ -116,7 +115,7 @@ class ColdSigningTest():
assert len(res.unsigned_txset) > 0 assert len(res.unsigned_txset) > 0
unsigned_txset = res.unsigned_txset unsigned_txset = res.unsigned_txset
print 'Signing transaction with cold wallet' print('Signing transaction with cold wallet')
res = self.cold_wallet.describe_transfer(unsigned_txset = unsigned_txset) res = self.cold_wallet.describe_transfer(unsigned_txset = unsigned_txset)
assert len(res.desc) == 1 assert len(res.desc) == 1
desc = res.desc[0] desc = res.desc[0]
@ -140,7 +139,7 @@ class ColdSigningTest():
txid = res.tx_hash_list[0] txid = res.tx_hash_list[0]
assert len(txid) == 64 assert len(txid) == 64
print 'Submitting transaction with hot wallet' print('Submitting transaction with hot wallet')
res = self.hot_wallet.submit_transfer(signed_txset) res = self.hot_wallet.submit_transfer(signed_txset)
assert len(res.tx_hash_list) > 0 assert len(res.tx_hash_list) > 0
assert res.tx_hash_list[0] == txid assert res.tx_hash_list[0] == txid

View file

@ -36,6 +36,7 @@ Test the following RPCs:
""" """
from __future__ import print_function
from framework.daemon import Daemon from framework.daemon import Daemon
class DaemonGetInfoTest(): class DaemonGetInfoTest():

View file

@ -10,7 +10,7 @@ import string
import os import os
USAGE = 'usage: functional_tests_rpc.py <python> <srcdir> <builddir> [<tests-to-run> | all]' USAGE = 'usage: functional_tests_rpc.py <python> <srcdir> <builddir> [<tests-to-run> | all]'
DEFAULT_TESTS = ['daemon_info', 'blockchain', 'wallet_address', 'integrated_address', 'mining', 'transfer', 'txpool', 'multisig', 'cold_signing', 'sign_message', 'proofs', 'get_output_distribution'] DEFAULT_TESTS = ['bans', 'daemon_info', 'blockchain', 'wallet_address', 'integrated_address', 'mining', 'transfer', 'txpool', 'multisig', 'cold_signing', 'sign_message', 'proofs', 'get_output_distribution']
try: try:
python = sys.argv[1] python = sys.argv[1]
srcdir = sys.argv[2] srcdir = sys.argv[2]

View file

@ -28,11 +28,10 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import time
"""Test get_output_distribution RPC """Test get_output_distribution RPC
""" """
from __future__ import print_function
from framework.daemon import Daemon from framework.daemon import Daemon
from framework.wallet import Wallet from framework.wallet import Wallet
@ -43,7 +42,7 @@ class GetOutputDistributionTest():
self.test_get_output_distribution() self.test_get_output_distribution()
def reset(self): def reset(self):
print 'Resetting blockchain' print('Resetting blockchain')
daemon = Daemon() daemon = Daemon()
daemon.pop_blocks(1000) daemon.pop_blocks(1000)
daemon.flush_txpool() daemon.flush_txpool()
@ -56,7 +55,7 @@ class GetOutputDistributionTest():
res = self.wallet.restore_deterministic_wallet(seed = 'velvet lymph giddy number token physics poetry unquoted nibs useful sabotage limits benches lifestyle eden nitrogen anvil fewest avoid batch vials washing fences goat unquoted') res = self.wallet.restore_deterministic_wallet(seed = 'velvet lymph giddy number token physics poetry unquoted nibs useful sabotage limits benches lifestyle eden nitrogen anvil fewest avoid batch vials washing fences goat unquoted')
def test_get_output_distribution(self): def test_get_output_distribution(self):
print "Test get_output_distribution" print("Test get_output_distribution")
daemon = Daemon() daemon = Daemon()

View file

@ -28,8 +28,6 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import time
"""Test integrated address RPC calls """Test integrated address RPC calls
Test the following RPCs: Test the following RPCs:
@ -38,6 +36,7 @@ Test the following RPCs:
""" """
from __future__ import print_function
from framework.wallet import Wallet from framework.wallet import Wallet
class IntegratedAddressTest(): class IntegratedAddressTest():
@ -46,7 +45,7 @@ class IntegratedAddressTest():
self.check() self.check()
def create(self): def create(self):
print 'Creating wallet' print('Creating wallet')
wallet = Wallet() wallet = Wallet()
# close the wallet if any, will throw if none is loaded # close the wallet if any, will throw if none is loaded
try: wallet.close_wallet() try: wallet.close_wallet()
@ -59,7 +58,7 @@ class IntegratedAddressTest():
def check(self): def check(self):
wallet = Wallet() wallet = Wallet()
print 'Checking local address' print('Checking local address')
res = wallet.make_integrated_address(payment_id = '0123456789abcdef') res = wallet.make_integrated_address(payment_id = '0123456789abcdef')
assert res.integrated_address == '4CMe2PUhs4J4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfSbLRB61BQVATzerHGj' assert res.integrated_address == '4CMe2PUhs4J4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfSbLRB61BQVATzerHGj'
assert res.payment_id == '0123456789abcdef' assert res.payment_id == '0123456789abcdef'
@ -67,7 +66,7 @@ class IntegratedAddressTest():
assert res.standard_address == '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm' assert res.standard_address == '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm'
assert res.payment_id == '0123456789abcdef' assert res.payment_id == '0123456789abcdef'
print 'Checking different address' print('Checking different address')
res = wallet.make_integrated_address(standard_address = '46r4nYSevkfBUMhuykdK3gQ98XDqDTYW1hNLaXNvjpsJaSbNtdXh1sKMsdVgqkaihChAzEy29zEDPMR3NHQvGoZCLGwTerK', payment_id = '1122334455667788') res = wallet.make_integrated_address(standard_address = '46r4nYSevkfBUMhuykdK3gQ98XDqDTYW1hNLaXNvjpsJaSbNtdXh1sKMsdVgqkaihChAzEy29zEDPMR3NHQvGoZCLGwTerK', payment_id = '1122334455667788')
assert res.integrated_address == '4GYjoMG9Y2BBUMhuykdK3gQ98XDqDTYW1hNLaXNvjpsJaSbNtdXh1sKMsdVgqkaihChAzEy29zEDPMR3NHQvGoZCVSs1ZojwrDCGS5rUuo' assert res.integrated_address == '4GYjoMG9Y2BBUMhuykdK3gQ98XDqDTYW1hNLaXNvjpsJaSbNtdXh1sKMsdVgqkaihChAzEy29zEDPMR3NHQvGoZCVSs1ZojwrDCGS5rUuo'
assert res.payment_id == '1122334455667788' assert res.payment_id == '1122334455667788'
@ -75,7 +74,7 @@ class IntegratedAddressTest():
assert res.standard_address == '46r4nYSevkfBUMhuykdK3gQ98XDqDTYW1hNLaXNvjpsJaSbNtdXh1sKMsdVgqkaihChAzEy29zEDPMR3NHQvGoZCLGwTerK' assert res.standard_address == '46r4nYSevkfBUMhuykdK3gQ98XDqDTYW1hNLaXNvjpsJaSbNtdXh1sKMsdVgqkaihChAzEy29zEDPMR3NHQvGoZCLGwTerK'
assert res.payment_id == '1122334455667788' assert res.payment_id == '1122334455667788'
print 'Checking bad payment id' print('Checking bad payment id')
fails = 0 fails = 0
try: wallet.make_integrated_address(standard_address = '46r4nYSevkfBUMhuykdK3gQ98XDqDTYW1hNLaXNvjpsJaSbNtdXh1sKMsdVgqkaihChAzEy29zEDPMR3NHQvGoZCLGwTerK', payment_id = '11223344556677880') try: wallet.make_integrated_address(standard_address = '46r4nYSevkfBUMhuykdK3gQ98XDqDTYW1hNLaXNvjpsJaSbNtdXh1sKMsdVgqkaihChAzEy29zEDPMR3NHQvGoZCLGwTerK', payment_id = '11223344556677880')
except: fails += 1 except: fails += 1
@ -89,7 +88,7 @@ class IntegratedAddressTest():
except: fails += 1 except: fails += 1
assert fails == 5 assert fails == 5
print 'Checking bad standard address' print('Checking bad standard address')
fails = 0 fails = 0
try: wallet.make_integrated_address(standard_address = '46r4nYSevkfBUMhuykdK3gQ98XDqDTYW1hNLaXNvjpsJaSbNtdXh1sKMsdVgqkaihChAzEy29zEDPMR3NHQvGoZCLGwTerr', payment_id = '1122334455667788') try: wallet.make_integrated_address(standard_address = '46r4nYSevkfBUMhuykdK3gQ98XDqDTYW1hNLaXNvjpsJaSbNtdXh1sKMsdVgqkaihChAzEy29zEDPMR3NHQvGoZCLGwTerr', payment_id = '1122334455667788')
except: fails += 1 except: fails += 1

View file

@ -28,6 +28,7 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from __future__ import print_function
import time import time
"""Test daemon mining RPC calls """Test daemon mining RPC calls
@ -48,13 +49,13 @@ class MiningTest():
self.mine() self.mine()
def reset(self): def reset(self):
print 'Resetting blockchain' print('Resetting blockchain')
daemon = Daemon() daemon = Daemon()
daemon.pop_blocks(1000) daemon.pop_blocks(1000)
daemon.flush_txpool() daemon.flush_txpool()
def create(self): def create(self):
print 'Creating wallet' print('Creating wallet')
wallet = Wallet() wallet = Wallet()
# close the wallet if any, will throw if none is loaded # close the wallet if any, will throw if none is loaded
try: wallet.close_wallet() try: wallet.close_wallet()
@ -62,7 +63,7 @@ class MiningTest():
res = wallet.restore_deterministic_wallet(seed = 'velvet lymph giddy number token physics poetry unquoted nibs useful sabotage limits benches lifestyle eden nitrogen anvil fewest avoid batch vials washing fences goat unquoted') res = wallet.restore_deterministic_wallet(seed = 'velvet lymph giddy number token physics poetry unquoted nibs useful sabotage limits benches lifestyle eden nitrogen anvil fewest avoid batch vials washing fences goat unquoted')
def mine(self): def mine(self):
print "Test mining" print("Test mining")
daemon = Daemon() daemon = Daemon()
wallet = Wallet() wallet = Wallet()

View file

@ -28,7 +28,7 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import time from __future__ import print_function
"""Test multisig transfers """Test multisig transfers
""" """
@ -70,7 +70,7 @@ class MultisigTest():
self.check_transaction(txid) self.check_transaction(txid)
def reset(self): def reset(self):
print 'Resetting blockchain' print('Resetting blockchain')
daemon = Daemon() daemon = Daemon()
daemon.pop_blocks(1000) daemon.pop_blocks(1000)
daemon.flush_txpool() daemon.flush_txpool()

View file

@ -28,7 +28,7 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import time from __future__ import print_function
"""Test misc proofs (tx key, send, receive, reserve) """Test misc proofs (tx key, send, receive, reserve)
""" """
@ -47,7 +47,7 @@ class ProofsTest():
self.check_reserve_proof() self.check_reserve_proof()
def reset(self): def reset(self):
print 'Resetting blockchain' print('Resetting blockchain')
daemon = Daemon() daemon = Daemon()
daemon.pop_blocks(1000) daemon.pop_blocks(1000)
daemon.flush_txpool() daemon.flush_txpool()

View file

@ -28,7 +28,7 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import time from __future__ import print_function
"""Test message signing/verification RPC calls """Test message signing/verification RPC calls
@ -46,7 +46,7 @@ class MessageSigningTest():
self.check_signing() self.check_signing()
def create(self): def create(self):
print 'Creating wallets' print('Creating wallets')
seeds = [ seeds = [
'velvet lymph giddy number token physics poetry unquoted nibs useful sabotage limits benches lifestyle eden nitrogen anvil fewest avoid batch vials washing fences goat unquoted', 'velvet lymph giddy number token physics poetry unquoted nibs useful sabotage limits benches lifestyle eden nitrogen anvil fewest avoid batch vials washing fences goat unquoted',
'peeled mixture ionic radar utopia puddle buying illness nuns gadget river spout cavernous bounced paradise drunk looking cottage jump tequila melting went winter adjust spout', 'peeled mixture ionic radar utopia puddle buying illness nuns gadget river spout cavernous bounced paradise drunk looking cottage jump tequila melting went winter adjust spout',
@ -66,7 +66,7 @@ class MessageSigningTest():
assert res.seed == seeds[i] assert res.seed == seeds[i]
def check_signing(self): def check_signing(self):
print 'Signing/verifing messages' print('Signing/verifing messages')
messages = ['foo', ''] messages = ['foo', '']
for message in messages: for message in messages:
res = self.wallet[0].sign(message) res = self.wallet[0].sign(message)

View file

@ -40,7 +40,7 @@ Test the following RPCs:
import time import time
from time import sleep from time import sleep
from decimal import Decimal from __future__ import print_function
from framework.daemon import Daemon from framework.daemon import Daemon
from framework.wallet import Wallet from framework.wallet import Wallet

View file

@ -28,7 +28,7 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import time from __future__ import print_function
import json import json
"""Test simple transfers """Test simple transfers
@ -48,13 +48,13 @@ class TransferTest():
self.sweep_single() self.sweep_single()
def reset(self): def reset(self):
print 'Resetting blockchain' print('Resetting blockchain')
daemon = Daemon() daemon = Daemon()
daemon.pop_blocks(1000) daemon.pop_blocks(1000)
daemon.flush_txpool() daemon.flush_txpool()
def create(self): def create(self):
print 'Creating wallets' print('Creating wallets')
seeds = [ seeds = [
'velvet lymph giddy number token physics poetry unquoted nibs useful sabotage limits benches lifestyle eden nitrogen anvil fewest avoid batch vials washing fences goat unquoted', 'velvet lymph giddy number token physics poetry unquoted nibs useful sabotage limits benches lifestyle eden nitrogen anvil fewest avoid batch vials washing fences goat unquoted',
'peeled mixture ionic radar utopia puddle buying illness nuns gadget river spout cavernous bounced paradise drunk looking cottage jump tequila melting went winter adjust spout', 'peeled mixture ionic radar utopia puddle buying illness nuns gadget river spout cavernous bounced paradise drunk looking cottage jump tequila melting went winter adjust spout',
@ -297,7 +297,7 @@ class TransferTest():
assert res.unlocked_balance <= res.balance assert res.unlocked_balance <= res.balance
assert res.blocks_to_unlock == 9 assert res.blocks_to_unlock == 9
print 'Creating multi out transfer' print('Creating multi out transfer')
self.wallet[0].refresh() self.wallet[0].refresh()

View file

@ -28,7 +28,7 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import time from __future__ import print_function
"""Test txpool """Test txpool
""" """
@ -44,13 +44,13 @@ class TransferTest():
self.check_txpool() self.check_txpool()
def reset(self): def reset(self):
print 'Resetting blockchain' print('Resetting blockchain')
daemon = Daemon() daemon = Daemon()
daemon.pop_blocks(1000) daemon.pop_blocks(1000)
daemon.flush_txpool() daemon.flush_txpool()
def create(self): def create(self):
print 'Creating wallet' print('Creating wallet')
wallet = Wallet() wallet = Wallet()
# close the wallet if any, will throw if none is loaded # close the wallet if any, will throw if none is loaded
try: wallet.close_wallet() try: wallet.close_wallet()
@ -114,15 +114,16 @@ class TransferTest():
assert sorted(res.tx_hashes) == sorted(txes.keys()) assert sorted(res.tx_hashes) == sorted(txes.keys())
print('Flushing 2 transactions') print('Flushing 2 transactions')
daemon.flush_txpool([txes.keys()[1], txes.keys()[3]]) txes_keys = list(txes.keys())
daemon.flush_txpool([txes_keys[1], txes_keys[3]])
res = daemon.get_transaction_pool() res = daemon.get_transaction_pool()
assert len(res.transactions) == txpool_size - 2 assert len(res.transactions) == txpool_size - 2
assert len([x for x in res.transactions if x.id_hash == txes.keys()[1]]) == 0 assert len([x for x in res.transactions if x.id_hash == txes_keys[1]]) == 0
assert len([x for x in res.transactions if x.id_hash == txes.keys()[3]]) == 0 assert len([x for x in res.transactions if x.id_hash == txes_keys[3]]) == 0
new_keys = txes.keys() new_keys = list(txes.keys())
new_keys.remove(txes.keys()[1]) new_keys.remove(txes_keys[1])
new_keys.remove(txes.keys()[3]) new_keys.remove(txes_keys[3])
res = daemon.get_transaction_pool_hashes() res = daemon.get_transaction_pool_hashes()
assert sorted(res.tx_hashes) == sorted(new_keys) assert sorted(res.tx_hashes) == sorted(new_keys)

View file

@ -29,8 +29,6 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import time
"""Test transaction creation RPC calls """Test transaction creation RPC calls
Test the following RPCs: Test the following RPCs:
@ -38,6 +36,7 @@ Test the following RPCs:
""" """
from __future__ import print_function
from framework.wallet import Wallet from framework.wallet import Wallet
from framework.daemon import Daemon from framework.daemon import Daemon
@ -52,13 +51,13 @@ class WalletAddressTest():
self.languages() self.languages()
def reset(self): def reset(self):
print 'Resetting blockchain' print('Resetting blockchain')
daemon = Daemon() daemon = Daemon()
daemon.pop_blocks(1000) daemon.pop_blocks(1000)
daemon.flush_txpool() daemon.flush_txpool()
def create(self): def create(self):
print 'Creating wallet' print('Creating wallet')
wallet = Wallet() wallet = Wallet()
# close the wallet if any, will throw if none is loaded # close the wallet if any, will throw if none is loaded
try: wallet.close_wallet() try: wallet.close_wallet()
@ -69,7 +68,7 @@ class WalletAddressTest():
assert res.seed == seed assert res.seed == seed
def check_main_address(self): def check_main_address(self):
print 'Getting address' print('Getting address')
wallet = Wallet() wallet = Wallet()
res = wallet.get_address() res = wallet.get_address()
assert res.address == '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', res assert res.address == '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', res
@ -79,7 +78,7 @@ class WalletAddressTest():
assert res.addresses[0].used == False assert res.addresses[0].used == False
def check_keys(self): def check_keys(self):
print 'Checking keys' print('Checking keys')
wallet = Wallet() wallet = Wallet()
res = wallet.query_key('view_key') res = wallet.query_key('view_key')
assert res.key == '49774391fa5e8d249fc2c5b45dadef13534bf2483dede880dac88f061e809100' assert res.key == '49774391fa5e8d249fc2c5b45dadef13534bf2483dede880dac88f061e809100'
@ -89,7 +88,7 @@ class WalletAddressTest():
assert res.key == 'velvet lymph giddy number token physics poetry unquoted nibs useful sabotage limits benches lifestyle eden nitrogen anvil fewest avoid batch vials washing fences goat unquoted' assert res.key == 'velvet lymph giddy number token physics poetry unquoted nibs useful sabotage limits benches lifestyle eden nitrogen anvil fewest avoid batch vials washing fences goat unquoted'
def create_subaddresses(self): def create_subaddresses(self):
print 'Creating subaddresses' print('Creating subaddresses')
wallet = Wallet() wallet = Wallet()
res = wallet.create_account("idx1") res = wallet.create_account("idx1")
assert res.account_index == 1, res assert res.account_index == 1, res
@ -160,7 +159,7 @@ class WalletAddressTest():
assert res.index == {'major': 1, 'minor': 0} assert res.index == {'major': 1, 'minor': 0}
def open_close(self): def open_close(self):
print 'Testing open/close' print('Testing open/close')
wallet = Wallet() wallet = Wallet()
res = wallet.get_address() res = wallet.get_address()
@ -200,7 +199,7 @@ class WalletAddressTest():
except: pass except: pass
languages = res.languages languages = res.languages
for language in languages: for language in languages:
print 'Creating ' + str(language) + ' wallet' print('Creating ' + str(language) + ' wallet')
wallet.create_wallet(filename = '', language = language) wallet.create_wallet(filename = '', language = language)
res = wallet.query_key('mnemonic') res = wallet.query_key('mnemonic')
wallet.close_wallet() wallet.close_wallet()