aboutsummaryrefslogtreecommitdiff
path: root/tests/functional_tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/functional_tests')
-rwxr-xr-xtests/functional_tests/bans.py3
-rwxr-xr-xtests/functional_tests/blockchain.py23
-rwxr-xr-xtests/functional_tests/cold_signing.py11
-rwxr-xr-xtests/functional_tests/daemon_info.py1
-rwxr-xr-xtests/functional_tests/functional_tests_rpc.py2
-rwxr-xr-xtests/functional_tests/get_output_distribution.py225
-rwxr-xr-xtests/functional_tests/integrated_address.py13
-rwxr-xr-xtests/functional_tests/mining.py7
-rwxr-xr-xtests/functional_tests/multisig.py4
-rwxr-xr-xtests/functional_tests/proofs.py4
-rwxr-xr-xtests/functional_tests/sign_message.py6
-rwxr-xr-xtests/functional_tests/speed.py2
-rwxr-xr-xtests/functional_tests/transfer.py11
-rwxr-xr-xtests/functional_tests/txpool.py19
-rwxr-xr-xtests/functional_tests/wallet_address.py17
15 files changed, 289 insertions, 59 deletions
diff --git a/tests/functional_tests/bans.py b/tests/functional_tests/bans.py
index bb3051a6a..e859e58c9 100755
--- a/tests/functional_tests/bans.py
+++ b/tests/functional_tests/bans.py
@@ -28,6 +28,7 @@
# 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.
+from __future__ import print_function
import time
"""Test peer baning RPC calls
@@ -42,7 +43,7 @@ from framework.daemon import Daemon
class BanTest():
def run_test(self):
- print 'Testing bans'
+ print('Testing bans')
daemon = Daemon()
res = daemon.get_bans()
diff --git a/tests/functional_tests/blockchain.py b/tests/functional_tests/blockchain.py
index 6376b86d0..2bd7672c0 100755
--- a/tests/functional_tests/blockchain.py
+++ b/tests/functional_tests/blockchain.py
@@ -28,6 +28,7 @@
# 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.
+from __future__ import print_function
import time
"""Test daemon blockchain RPC calls
@@ -50,7 +51,7 @@ class BlockchainTest():
self._test_alt_chains()
def reset(self):
- print 'Resetting blockchain'
+ print('Resetting blockchain')
daemon = Daemon()
daemon.pop_blocks(1000)
daemon.flush_txpool()
@@ -58,7 +59,7 @@ class BlockchainTest():
def _test_generateblocks(self, blocks):
assert blocks >= 2
- print "Test generating", blocks, 'blocks'
+ print("Test generating", blocks, 'blocks')
daemon = Daemon()
@@ -73,7 +74,7 @@ class BlockchainTest():
# we should not see a block at height
ok = False
- try: daemon.getblock(height)
+ try: daemon.getblock(height = height)
except: ok = True
assert ok
@@ -91,7 +92,7 @@ class BlockchainTest():
# get the blocks, check they have the right height
res_getblock = []
for n in range(blocks):
- res_getblock.append(daemon.getblock(height + n))
+ res_getblock.append(daemon.getblock(height = height + n))
block_header = res_getblock[n].block_header
assert abs(block_header.timestamp - time.time()) < 10 # within 10 seconds
assert block_header.height == height + n
@@ -110,7 +111,7 @@ class BlockchainTest():
# we should not see a block after that
ok = False
- try: daemon.getblock(height + blocks)
+ try: daemon.getblock(height = height + blocks)
except: ok = True
assert ok
@@ -156,7 +157,7 @@ class BlockchainTest():
# we should not see the popped block anymore
ok = False
- try: daemon.getblock(height + blocks - 1)
+ try: daemon.getblock(height = height + blocks - 1)
except: ok = True
assert ok
@@ -182,14 +183,14 @@ class BlockchainTest():
for idx in tx.output_indices:
assert idx == running_output_index
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)
for out in res_out.outs:
assert len(out.key) == 64
assert len(out.mask) == 64
assert not out.unlocked
- assert out.height == i + 1
- assert out.txid == txids[i + 1]
+ assert out.height == i
+ assert out.txid == txids[i]
for i in range(height + nblocks - 1):
res_sum = daemon.get_coinbase_tx_sum(i, 1)
@@ -255,7 +256,7 @@ class BlockchainTest():
alt_blocks[i] = txid
nonce += 1
- print 'mining 3 on 1'
+ print('mining 3 on 1')
# three more on [1]
chain1 = []
res = daemon.generateblocks('42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 3, prev_block = alt_blocks[1], starting_nonce = nonce)
@@ -275,7 +276,7 @@ class BlockchainTest():
for txid in alt_blocks:
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
top_block_hash = blk_hash
prev_block = alt_blocks[3]
diff --git a/tests/functional_tests/cold_signing.py b/tests/functional_tests/cold_signing.py
index 59a879e0a..a722d8927 100755
--- a/tests/functional_tests/cold_signing.py
+++ b/tests/functional_tests/cold_signing.py
@@ -28,11 +28,10 @@
# 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.
-import time
-
"""Test cold tx signing
"""
+from __future__ import print_function
from framework.daemon import Daemon
from framework.wallet import Wallet
@@ -44,13 +43,13 @@ class ColdSigningTest():
self.transfer()
def reset(self):
- print 'Resetting blockchain'
+ print('Resetting blockchain')
daemon = Daemon()
daemon.pop_blocks(1000)
daemon.flush_txpool()
def create(self, idx):
- print 'Creating hot and cold wallet'
+ print('Creating hot and cold wallet')
self.hot_wallet = Wallet(idx = 0)
# close the wallet if any, will throw if none is loaded
@@ -116,7 +115,7 @@ class ColdSigningTest():
assert len(res.unsigned_txset) > 0
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)
assert len(res.desc) == 1
desc = res.desc[0]
@@ -140,7 +139,7 @@ class ColdSigningTest():
txid = res.tx_hash_list[0]
assert len(txid) == 64
- print 'Submitting transaction with hot wallet'
+ print('Submitting transaction with hot wallet')
res = self.hot_wallet.submit_transfer(signed_txset)
assert len(res.tx_hash_list) > 0
assert res.tx_hash_list[0] == txid
diff --git a/tests/functional_tests/daemon_info.py b/tests/functional_tests/daemon_info.py
index bd3528c3f..4fa768b03 100755
--- a/tests/functional_tests/daemon_info.py
+++ b/tests/functional_tests/daemon_info.py
@@ -36,6 +36,7 @@ Test the following RPCs:
"""
+from __future__ import print_function
from framework.daemon import Daemon
class DaemonGetInfoTest():
diff --git a/tests/functional_tests/functional_tests_rpc.py b/tests/functional_tests/functional_tests_rpc.py
index e754b4e33..25ab641ab 100755
--- a/tests/functional_tests/functional_tests_rpc.py
+++ b/tests/functional_tests/functional_tests_rpc.py
@@ -10,7 +10,7 @@ import string
import os
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']
+DEFAULT_TESTS = ['bans', 'daemon_info', 'blockchain', 'wallet_address', 'integrated_address', 'mining', 'transfer', 'txpool', 'multisig', 'cold_signing', 'sign_message', 'proofs', 'get_output_distribution']
try:
python = sys.argv[1]
srcdir = sys.argv[2]
diff --git a/tests/functional_tests/get_output_distribution.py b/tests/functional_tests/get_output_distribution.py
new file mode 100755
index 000000000..93822e90a
--- /dev/null
+++ b/tests/functional_tests/get_output_distribution.py
@@ -0,0 +1,225 @@
+#!/usr/bin/env python3
+
+# Copyright (c) 2019 The Monero Project
+#
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification, are
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this list of
+# conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice, this list
+# of conditions and the following disclaimer in the documentation and/or other
+# materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors may be
+# used to endorse or promote products derived from this software without specific
+# prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# 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.
+
+"""Test get_output_distribution RPC
+"""
+
+from __future__ import print_function
+from framework.daemon import Daemon
+from framework.wallet import Wallet
+
+class GetOutputDistributionTest():
+ def run_test(self):
+ self.reset()
+ self.create()
+ self.test_get_output_distribution()
+
+ def reset(self):
+ print('Resetting blockchain')
+ daemon = Daemon()
+ daemon.pop_blocks(1000)
+ daemon.flush_txpool()
+
+ def create(self):
+ self.wallet = Wallet()
+ # close the wallet if any, will throw if none is loaded
+ try: self.wallet.close_wallet()
+ except: pass
+ 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):
+ print("Test get_output_distribution")
+
+ daemon = Daemon()
+
+ res = daemon.get_output_distribution([0], 0, 0)
+ assert len(res.distributions) == 1
+ d = res.distributions[0]
+ assert d.amount == 0
+ assert d.base == 0
+ assert d.binary == False
+ assert len(d.distribution) == 1
+ assert d.distribution[0] == 0
+
+ res = daemon.generateblocks('42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 1)
+
+ res = daemon.get_output_distribution([0], 0, 0)
+ assert len(res.distributions) == 1
+ d = res.distributions[0]
+ assert d.amount == 0
+ assert d.base == 0
+ assert d.binary == False
+ assert len(d.distribution) == 2
+ assert d.distribution[0] == 0
+ assert d.distribution[1] == 1
+
+ res = daemon.pop_blocks(1)
+
+ res = daemon.get_output_distribution([0], 0, 0)
+ assert len(res.distributions) == 1
+ d = res.distributions[0]
+ assert d.amount == 0
+ assert d.base == 0
+ assert d.binary == False
+ assert len(d.distribution) == 1
+ assert d.distribution[0] == 0
+
+ res = daemon.generateblocks('42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 3)
+
+ res = daemon.get_output_distribution([0], 0, 0, cumulative = True)
+ assert len(res.distributions) == 1
+ d = res.distributions[0]
+ assert d.amount == 0
+ assert d.base == 0
+ assert d.binary == False
+ assert len(d.distribution) == 4
+ assert d.distribution[0] == 0
+ assert d.distribution[1] == 1
+ assert d.distribution[2] == 2
+ assert d.distribution[3] == 3
+
+ # extend
+ res = daemon.generateblocks('42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 80)
+
+ res = daemon.get_output_distribution([0], 0, 0, cumulative = True)
+ assert len(res.distributions) == 1
+ d = res.distributions[0]
+ assert d.amount == 0
+ assert d.base == 0
+ assert d.binary == False
+ assert len(d.distribution) == 84
+ for h in range(len(d.distribution)):
+ assert d.distribution[h] == h
+
+ # pop and replace, this will do through the "trim and extend" path
+ res = daemon.pop_blocks(2)
+ self.wallet.refresh()
+ dst = {'address': '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 'amount': 1000000000000}
+ self.wallet.transfer([dst])
+ res = daemon.generateblocks('42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 1)
+ for step in range(3): # the second will be cached, the third will also be cached, but we get it in non-cumulative mode
+ res = daemon.get_output_distribution([0], 0, 0, cumulative = step < 3)
+ assert len(res.distributions) == 1
+ d = res.distributions[0]
+ assert d.amount == 0
+ assert d.base == 0
+ assert d.binary == False
+ assert len(d.distribution) == 83
+ for h in range(len(d.distribution)):
+ assert d.distribution[h] == (h if step < 3 else 1) + (2 if h == len(d.distribution) - 1 else 0)
+
+ # start at 0, end earlier
+ res = daemon.get_output_distribution([0], 0, 40, cumulative = True)
+ assert len(res.distributions) == 1
+ d = res.distributions[0]
+ assert d.amount == 0
+ assert d.base == 0
+ assert d.binary == False
+ assert len(d.distribution) == 41
+ for h in range(len(d.distribution)):
+ assert d.distribution[h] == h
+
+ # start after 0, end earlier
+ res = daemon.get_output_distribution([0], 10, 20, cumulative = True)
+ assert len(res.distributions) == 1
+ d = res.distributions[0]
+ assert d.amount == 0
+ assert d.base == 9
+ assert d.binary == False
+ assert len(d.distribution) == 11
+ for h in range(len(d.distribution)):
+ assert d.distribution[h] == 10 + h
+
+ # straddling up
+ res = daemon.get_output_distribution([0], 15, 25, cumulative = True)
+ assert len(res.distributions) == 1
+ d = res.distributions[0]
+ assert d.amount == 0
+ assert d.base == 14
+ assert d.binary == False
+ assert len(d.distribution) == 11
+ for h in range(len(d.distribution)):
+ assert d.distribution[h] == 15 + h
+
+ # straddling down
+ res = daemon.get_output_distribution([0], 8, 18, cumulative = True)
+ assert len(res.distributions) == 1
+ d = res.distributions[0]
+ assert d.amount == 0
+ assert d.base == 7
+ assert d.binary == False
+ assert len(d.distribution) == 11
+ for h in range(len(d.distribution)):
+ assert d.distribution[h] == 8 + h
+
+ # encompassing
+ res = daemon.get_output_distribution([0], 5, 20, cumulative = True)
+ assert len(res.distributions) == 1
+ d = res.distributions[0]
+ assert d.amount == 0
+ assert d.base == 4
+ assert d.binary == False
+ assert len(d.distribution) == 16
+ for h in range(len(d.distribution)):
+ assert d.distribution[h] == 5 + h
+
+ # single
+ res = daemon.get_output_distribution([0], 2, 2, cumulative = True)
+ assert len(res.distributions) == 1
+ d = res.distributions[0]
+ assert d.amount == 0
+ assert d.base == 1
+ assert d.binary == False
+ assert len(d.distribution) == 1
+ assert d.distribution[0] == 2
+
+ # a non existent amount
+ res = daemon.get_output_distribution([1], 0, 0)
+ assert len(res.distributions) == 1
+ d = res.distributions[0]
+ assert d.amount == 1
+ assert d.base == 0
+ assert d.binary == False
+ assert len(d.distribution) == 83
+ for h in range(len(d.distribution)):
+ assert d.distribution[h] == 0
+
+
+class Guard:
+ def __enter__(self):
+ for i in range(4):
+ Wallet(idx = i).auto_refresh(False)
+ def __exit__(self, exc_type, exc_value, traceback):
+ for i in range(4):
+ Wallet(idx = i).auto_refresh(True)
+
+if __name__ == '__main__':
+ with Guard() as guard:
+ GetOutputDistributionTest().run_test()
diff --git a/tests/functional_tests/integrated_address.py b/tests/functional_tests/integrated_address.py
index 338dd14ae..4e42261a6 100755
--- a/tests/functional_tests/integrated_address.py
+++ b/tests/functional_tests/integrated_address.py
@@ -28,8 +28,6 @@
# 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.
-import time
-
"""Test integrated address RPC calls
Test the following RPCs:
@@ -38,6 +36,7 @@ Test the following RPCs:
"""
+from __future__ import print_function
from framework.wallet import Wallet
class IntegratedAddressTest():
@@ -46,7 +45,7 @@ class IntegratedAddressTest():
self.check()
def create(self):
- print 'Creating wallet'
+ print('Creating wallet')
wallet = Wallet()
# close the wallet if any, will throw if none is loaded
try: wallet.close_wallet()
@@ -59,7 +58,7 @@ class IntegratedAddressTest():
def check(self):
wallet = Wallet()
- print 'Checking local address'
+ print('Checking local address')
res = wallet.make_integrated_address(payment_id = '0123456789abcdef')
assert res.integrated_address == '4CMe2PUhs4J4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfSbLRB61BQVATzerHGj'
assert res.payment_id == '0123456789abcdef'
@@ -67,7 +66,7 @@ class IntegratedAddressTest():
assert res.standard_address == '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm'
assert res.payment_id == '0123456789abcdef'
- print 'Checking different address'
+ print('Checking different address')
res = wallet.make_integrated_address(standard_address = '46r4nYSevkfBUMhuykdK3gQ98XDqDTYW1hNLaXNvjpsJaSbNtdXh1sKMsdVgqkaihChAzEy29zEDPMR3NHQvGoZCLGwTerK', payment_id = '1122334455667788')
assert res.integrated_address == '4GYjoMG9Y2BBUMhuykdK3gQ98XDqDTYW1hNLaXNvjpsJaSbNtdXh1sKMsdVgqkaihChAzEy29zEDPMR3NHQvGoZCVSs1ZojwrDCGS5rUuo'
assert res.payment_id == '1122334455667788'
@@ -75,7 +74,7 @@ class IntegratedAddressTest():
assert res.standard_address == '46r4nYSevkfBUMhuykdK3gQ98XDqDTYW1hNLaXNvjpsJaSbNtdXh1sKMsdVgqkaihChAzEy29zEDPMR3NHQvGoZCLGwTerK'
assert res.payment_id == '1122334455667788'
- print 'Checking bad payment id'
+ print('Checking bad payment id')
fails = 0
try: wallet.make_integrated_address(standard_address = '46r4nYSevkfBUMhuykdK3gQ98XDqDTYW1hNLaXNvjpsJaSbNtdXh1sKMsdVgqkaihChAzEy29zEDPMR3NHQvGoZCLGwTerK', payment_id = '11223344556677880')
except: fails += 1
@@ -89,7 +88,7 @@ class IntegratedAddressTest():
except: fails += 1
assert fails == 5
- print 'Checking bad standard address'
+ print('Checking bad standard address')
fails = 0
try: wallet.make_integrated_address(standard_address = '46r4nYSevkfBUMhuykdK3gQ98XDqDTYW1hNLaXNvjpsJaSbNtdXh1sKMsdVgqkaihChAzEy29zEDPMR3NHQvGoZCLGwTerr', payment_id = '1122334455667788')
except: fails += 1
diff --git a/tests/functional_tests/mining.py b/tests/functional_tests/mining.py
index 78dc68640..5c14d34fd 100755
--- a/tests/functional_tests/mining.py
+++ b/tests/functional_tests/mining.py
@@ -28,6 +28,7 @@
# 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.
+from __future__ import print_function
import time
"""Test daemon mining RPC calls
@@ -48,13 +49,13 @@ class MiningTest():
self.mine()
def reset(self):
- print 'Resetting blockchain'
+ print('Resetting blockchain')
daemon = Daemon()
daemon.pop_blocks(1000)
daemon.flush_txpool()
def create(self):
- print 'Creating wallet'
+ print('Creating wallet')
wallet = Wallet()
# close the wallet if any, will throw if none is loaded
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')
def mine(self):
- print "Test mining"
+ print("Test mining")
daemon = Daemon()
wallet = Wallet()
diff --git a/tests/functional_tests/multisig.py b/tests/functional_tests/multisig.py
index 476e3a02d..3c8cd9c1d 100755
--- a/tests/functional_tests/multisig.py
+++ b/tests/functional_tests/multisig.py
@@ -28,7 +28,7 @@
# 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.
-import time
+from __future__ import print_function
"""Test multisig transfers
"""
@@ -70,7 +70,7 @@ class MultisigTest():
self.check_transaction(txid)
def reset(self):
- print 'Resetting blockchain'
+ print('Resetting blockchain')
daemon = Daemon()
daemon.pop_blocks(1000)
daemon.flush_txpool()
diff --git a/tests/functional_tests/proofs.py b/tests/functional_tests/proofs.py
index 844131095..243929dc3 100755
--- a/tests/functional_tests/proofs.py
+++ b/tests/functional_tests/proofs.py
@@ -28,7 +28,7 @@
# 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.
-import time
+from __future__ import print_function
"""Test misc proofs (tx key, send, receive, reserve)
"""
@@ -47,7 +47,7 @@ class ProofsTest():
self.check_reserve_proof()
def reset(self):
- print 'Resetting blockchain'
+ print('Resetting blockchain')
daemon = Daemon()
daemon.pop_blocks(1000)
daemon.flush_txpool()
diff --git a/tests/functional_tests/sign_message.py b/tests/functional_tests/sign_message.py
index 4c3ec3588..de8f0cee2 100755
--- a/tests/functional_tests/sign_message.py
+++ b/tests/functional_tests/sign_message.py
@@ -28,7 +28,7 @@
# 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.
-import time
+from __future__ import print_function
"""Test message signing/verification RPC calls
@@ -46,7 +46,7 @@ class MessageSigningTest():
self.check_signing()
def create(self):
- print 'Creating wallets'
+ print('Creating wallets')
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',
'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]
def check_signing(self):
- print 'Signing/verifing messages'
+ print('Signing/verifing messages')
messages = ['foo', '']
for message in messages:
res = self.wallet[0].sign(message)
diff --git a/tests/functional_tests/speed.py b/tests/functional_tests/speed.py
index bd8892df8..ed1e332e9 100755
--- a/tests/functional_tests/speed.py
+++ b/tests/functional_tests/speed.py
@@ -40,7 +40,7 @@ Test the following RPCs:
import time
from time import sleep
-from decimal import Decimal
+from __future__ import print_function
from framework.daemon import Daemon
from framework.wallet import Wallet
diff --git a/tests/functional_tests/transfer.py b/tests/functional_tests/transfer.py
index 1ff641d1f..d9a6e592e 100755
--- a/tests/functional_tests/transfer.py
+++ b/tests/functional_tests/transfer.py
@@ -28,7 +28,7 @@
# 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.
-import time
+from __future__ import print_function
import json
"""Test simple transfers
@@ -48,13 +48,13 @@ class TransferTest():
self.sweep_single()
def reset(self):
- print 'Resetting blockchain'
+ print('Resetting blockchain')
daemon = Daemon()
daemon.pop_blocks(1000)
daemon.flush_txpool()
def create(self):
- print 'Creating wallets'
+ print('Creating wallets')
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',
'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.blocks_to_unlock == 9
- print 'Creating multi out transfer'
+ print('Creating multi out transfer')
self.wallet[0].refresh()
@@ -519,6 +519,9 @@ class TransferTest():
res = self.wallet[2].get_bulk_payments(payment_ids = ['1'*64, '1234500000012345abcde00000abcdeff1234500000012345abcde00000abcde', '2'*64])
assert len(res.payments) >= 1 # one tx was sent
+ res = self.wallet[1].get_bulk_payments(["1111111122222222"])
+ assert len(res.payments) >= 1 # we have one of these
+
def check_double_spend_detection(self):
print('Checking double spend detection')
txes = [[None, None], [None, None]]
diff --git a/tests/functional_tests/txpool.py b/tests/functional_tests/txpool.py
index d74395f10..b6af4c84f 100755
--- a/tests/functional_tests/txpool.py
+++ b/tests/functional_tests/txpool.py
@@ -28,7 +28,7 @@
# 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.
-import time
+from __future__ import print_function
"""Test txpool
"""
@@ -44,13 +44,13 @@ class TransferTest():
self.check_txpool()
def reset(self):
- print 'Resetting blockchain'
+ print('Resetting blockchain')
daemon = Daemon()
daemon.pop_blocks(1000)
daemon.flush_txpool()
def create(self):
- print 'Creating wallet'
+ print('Creating wallet')
wallet = Wallet()
# close the wallet if any, will throw if none is loaded
try: wallet.close_wallet()
@@ -114,15 +114,16 @@ class TransferTest():
assert sorted(res.tx_hashes) == sorted(txes.keys())
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()
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()[3]]) == 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
- new_keys = txes.keys()
- new_keys.remove(txes.keys()[1])
- new_keys.remove(txes.keys()[3])
+ new_keys = list(txes.keys())
+ new_keys.remove(txes_keys[1])
+ new_keys.remove(txes_keys[3])
res = daemon.get_transaction_pool_hashes()
assert sorted(res.tx_hashes) == sorted(new_keys)
diff --git a/tests/functional_tests/wallet_address.py b/tests/functional_tests/wallet_address.py
index 8a55521c6..4ff059a6f 100755
--- a/tests/functional_tests/wallet_address.py
+++ b/tests/functional_tests/wallet_address.py
@@ -29,8 +29,6 @@
# 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.
-import time
-
"""Test transaction creation RPC calls
Test the following RPCs:
@@ -38,6 +36,7 @@ Test the following RPCs:
"""
+from __future__ import print_function
from framework.wallet import Wallet
from framework.daemon import Daemon
@@ -52,13 +51,13 @@ class WalletAddressTest():
self.languages()
def reset(self):
- print 'Resetting blockchain'
+ print('Resetting blockchain')
daemon = Daemon()
daemon.pop_blocks(1000)
daemon.flush_txpool()
def create(self):
- print 'Creating wallet'
+ print('Creating wallet')
wallet = Wallet()
# close the wallet if any, will throw if none is loaded
try: wallet.close_wallet()
@@ -69,7 +68,7 @@ class WalletAddressTest():
assert res.seed == seed
def check_main_address(self):
- print 'Getting address'
+ print('Getting address')
wallet = Wallet()
res = wallet.get_address()
assert res.address == '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', res
@@ -79,7 +78,7 @@ class WalletAddressTest():
assert res.addresses[0].used == False
def check_keys(self):
- print 'Checking keys'
+ print('Checking keys')
wallet = Wallet()
res = wallet.query_key('view_key')
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'
def create_subaddresses(self):
- print 'Creating subaddresses'
+ print('Creating subaddresses')
wallet = Wallet()
res = wallet.create_account("idx1")
assert res.account_index == 1, res
@@ -160,7 +159,7 @@ class WalletAddressTest():
assert res.index == {'major': 1, 'minor': 0}
def open_close(self):
- print 'Testing open/close'
+ print('Testing open/close')
wallet = Wallet()
res = wallet.get_address()
@@ -200,7 +199,7 @@ class WalletAddressTest():
except: pass
languages = res.languages
for language in languages:
- print 'Creating ' + str(language) + ' wallet'
+ print('Creating ' + str(language) + ' wallet')
wallet.create_wallet(filename = '', language = language)
res = wallet.query_key('mnemonic')
wallet.close_wallet()