functional_tests: python3 compatibility
and add missing tests
This commit is contained in:
parent
1fac83858a
commit
6b72541dc0
|
@ -32,6 +32,7 @@
|
|||
"""Test wallet address book RPC
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
from framework.wallet import Wallet
|
||||
|
||||
class AddressBookTest():
|
||||
|
@ -40,7 +41,7 @@ class AddressBookTest():
|
|||
self.test_address_book()
|
||||
|
||||
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()
|
||||
|
@ -51,7 +52,7 @@ class AddressBookTest():
|
|||
assert res.seed == seed
|
||||
|
||||
def test_address_book(self):
|
||||
print 'Testing address book'
|
||||
print('Testing address book')
|
||||
wallet = Wallet()
|
||||
|
||||
# empty at start
|
||||
|
|
|
@ -10,7 +10,7 @@ import string
|
|||
import os
|
||||
|
||||
USAGE = 'usage: functional_tests_rpc.py <python> <srcdir> <builddir> [<tests-to-run> | all]'
|
||||
DEFAULT_TESTS = ['bans', 'daemon_info', 'blockchain', 'wallet', 'integrated_address', 'mining', 'transfer', 'txpool', 'multisig', 'cold_signing', 'sign_message', 'proofs', 'get_output_distribution', 'address_book', 'uri']
|
||||
DEFAULT_TESTS = ['address_book', 'bans', 'blockchain', 'cold_signing', 'daemon_info', 'get_output_distribution', 'integrated_address', 'mining', 'multisig', 'proofs', 'sign_message', 'transfer', 'txpool', 'uri', 'validate_address', 'wallet']
|
||||
try:
|
||||
python = sys.argv[1]
|
||||
srcdir = sys.argv[2]
|
||||
|
@ -135,6 +135,6 @@ else:
|
|||
if len(FAIL) == 0:
|
||||
print('Done, ' + str(len(PASS)) + '/' + str(len(tests)) + ' tests passed')
|
||||
else:
|
||||
print('Done, ' + str(len(FAIL)) + '/' + str(len(tests)) + ' tests failed: ' + string.join(FAIL, ', '))
|
||||
print('Done, ' + str(len(FAIL)) + '/' + str(len(tests)) + ' tests failed: ' + ', '.join(FAIL))
|
||||
|
||||
sys.exit(0 if len(FAIL) == 0 else 1)
|
||||
|
|
|
@ -143,7 +143,7 @@ class MiningTest():
|
|||
assert res_status.active == False
|
||||
|
||||
def submitblock(self):
|
||||
print "Test submitblock"
|
||||
print("Test submitblock")
|
||||
|
||||
daemon = Daemon()
|
||||
res = daemon.get_height()
|
||||
|
|
|
@ -48,7 +48,7 @@ from framework.wallet import Wallet
|
|||
|
||||
class SpeedTest():
|
||||
def reset(self):
|
||||
print 'Resetting blockchain'
|
||||
print('Resetting blockchain')
|
||||
daemon = Daemon()
|
||||
res = daemon.get_height()
|
||||
daemon.pop_blocks(res.height - 1)
|
||||
|
|
|
@ -792,7 +792,7 @@ class TransferTest():
|
|||
if not k in unrecoverable_fields:
|
||||
e[k] = x[k]
|
||||
new_t_out.append(e)
|
||||
assert sorted(old_t_out) == sorted(new_t_out)
|
||||
assert sorted(old_t_out, key = lambda k: k['txid']) == sorted(new_t_out, key = lambda k: k['txid'])
|
||||
|
||||
def check_is_key_image_spent(self):
|
||||
daemon = Daemon()
|
||||
|
|
|
@ -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 address validation RPC calls
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
from framework.wallet import Wallet
|
||||
|
||||
class AddressValidationTest():
|
||||
|
|
|
@ -58,7 +58,7 @@ class WalletTest():
|
|||
assert WALLET_DIRECTORY != ''
|
||||
try:
|
||||
os.unlink(WALLET_DIRECTORY + '/' + name)
|
||||
except OSError, e:
|
||||
except OSError as e:
|
||||
if e.errno != errno.ENOENT:
|
||||
raise
|
||||
|
||||
|
@ -183,7 +183,7 @@ class WalletTest():
|
|||
res = wallet.label_account(0, "main")
|
||||
|
||||
def tags(self):
|
||||
print 'Testing tags'
|
||||
print('Testing tags')
|
||||
wallet = Wallet()
|
||||
res = wallet.get_account_tags()
|
||||
assert not 'account_tags' in res or len(res.account_tags) == 0
|
||||
|
@ -256,7 +256,7 @@ class WalletTest():
|
|||
assert sorted(subaddress_accounts) == [(0, '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 'main'), (1, '82pP87g1Vkd3LUMssBCumk3MfyEsFqLAaGDf6oxddu61EgSFzt8gCwUD4tr3kp9TUfdPs2CnpD7xLZzyC1Ei9UsW3oyCWDf', 'idx1_new')]
|
||||
|
||||
def attributes(self):
|
||||
print 'Testing attributes'
|
||||
print('Testing attributes')
|
||||
wallet = Wallet()
|
||||
|
||||
ok = False
|
||||
|
@ -319,13 +319,13 @@ class WalletTest():
|
|||
languages = res.languages
|
||||
languages_local = res.languages_local
|
||||
for language in languages + languages_local:
|
||||
print('Creating ' + language.encode('utf8') + ' wallet')
|
||||
print('Creating ' + language + ' wallet')
|
||||
wallet.create_wallet(filename = '', language = language)
|
||||
res = wallet.query_key('mnemonic')
|
||||
wallet.close_wallet()
|
||||
|
||||
def change_password(self):
|
||||
print 'Testing password change'
|
||||
print('Testing password change')
|
||||
wallet = Wallet()
|
||||
|
||||
# close the wallet if any, will throw if none is loaded
|
||||
|
@ -359,7 +359,7 @@ class WalletTest():
|
|||
self.remove_wallet_files('test1')
|
||||
|
||||
def store(self):
|
||||
print 'Testing store'
|
||||
print('Testing store')
|
||||
wallet = Wallet()
|
||||
|
||||
# close the wallet if any, will throw if none is loaded
|
||||
|
|
Loading…
Reference in New Issue