functional_tests: move extraneous stuff out of the framework
This commit is contained in:
parent
2c171a9b02
commit
b9e09378ad
@ -47,14 +47,26 @@ from framework.wallet import Wallet
|
|||||||
|
|
||||||
|
|
||||||
class SpeedTest():
|
class SpeedTest():
|
||||||
def set_test_params(self):
|
def reset(self):
|
||||||
self.num_nodes = 1
|
print 'Resetting blockchain'
|
||||||
|
daemon = Daemon()
|
||||||
|
daemon.pop_blocks(1000)
|
||||||
|
daemon.flush_txpool()
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
|
self.reset()
|
||||||
|
|
||||||
daemon = Daemon()
|
daemon = Daemon()
|
||||||
wallet = Wallet()
|
wallet = Wallet()
|
||||||
|
|
||||||
destinations = wallet.make_uniform_destinations('44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A',1,3)
|
# close the wallet if any, will throw if none is loaded
|
||||||
|
try: wallet.close_wallet()
|
||||||
|
except: pass
|
||||||
|
wallet.restore_deterministic_wallet('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')
|
||||||
|
|
||||||
|
destinations = []
|
||||||
|
for i in range(3):
|
||||||
|
destinations.append({"amount":1,"address":'44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A'})
|
||||||
|
|
||||||
self._test_speed_generateblocks(daemon=daemon, blocks=70)
|
self._test_speed_generateblocks(daemon=daemon, blocks=70)
|
||||||
for i in range(1, 10):
|
for i in range(1, 10):
|
||||||
@ -69,7 +81,6 @@ class SpeedTest():
|
|||||||
start = time.time()
|
start = time.time()
|
||||||
|
|
||||||
res = daemon.generateblocks('42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', blocks)
|
res = daemon.generateblocks('42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', blocks)
|
||||||
# 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
|
|
||||||
|
|
||||||
print('generating ', blocks, 'blocks took: ', time.time() - start, 'seconds')
|
print('generating ', blocks, 'blocks took: ', time.time() - start, 'seconds')
|
||||||
|
|
||||||
@ -77,7 +88,7 @@ class SpeedTest():
|
|||||||
print('Test speed of transfer')
|
print('Test speed of transfer')
|
||||||
start = time.time()
|
start = time.time()
|
||||||
|
|
||||||
destinations = wallet.make_uniform_destinations('44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A',1)
|
destinations = [{"amount":1,"address":'44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A'}]
|
||||||
res = wallet.transfer_split(destinations)
|
res = wallet.transfer_split(destinations)
|
||||||
|
|
||||||
print('generating tx took: ', time.time() - start, 'seconds')
|
print('generating tx took: ', time.time() - start, 'seconds')
|
||||||
|
@ -37,18 +37,6 @@ class Wallet(object):
|
|||||||
self.port = port
|
self.port = port
|
||||||
self.rpc = JSONRPC('{protocol}://{host}:{port}'.format(protocol=protocol, host=host, port=port if port else 18090+idx))
|
self.rpc = JSONRPC('{protocol}://{host}:{port}'.format(protocol=protocol, host=host, port=port if port else 18090+idx))
|
||||||
|
|
||||||
def make_uniform_destinations(self, address, transfer_amount, transfer_number_of_destinations=1):
|
|
||||||
destinations = []
|
|
||||||
for i in range(transfer_number_of_destinations):
|
|
||||||
destinations.append({"amount":transfer_amount,"address":address})
|
|
||||||
return destinations
|
|
||||||
|
|
||||||
def make_destinations(self, addresses, transfer_amounts):
|
|
||||||
destinations = []
|
|
||||||
for i in range(len(addresses)):
|
|
||||||
destinations.append({'amount':transfer_amounts[i],'address':addresses[i]})
|
|
||||||
return destinations
|
|
||||||
|
|
||||||
def transfer(self, destinations, account_index = 0, subaddr_indices = [], priority = 0, ring_size = 0, unlock_time = 0, payment_id = '', get_tx_key = True, do_not_relay = False, get_tx_hex = False, get_tx_metadata = False):
|
def transfer(self, destinations, account_index = 0, subaddr_indices = [], priority = 0, ring_size = 0, unlock_time = 0, payment_id = '', get_tx_key = True, do_not_relay = False, get_tx_hex = False, get_tx_metadata = False):
|
||||||
transfer = {
|
transfer = {
|
||||||
'method': 'transfer',
|
'method': 'transfer',
|
||||||
|
Loading…
Reference in New Issue
Block a user