diff --git a/integration_tests/blockstack_integration_tests/scenarios/testlib.py b/integration_tests/blockstack_integration_tests/scenarios/testlib.py index c7a947185..ccaf1d520 100644 --- a/integration_tests/blockstack_integration_tests/scenarios/testlib.py +++ b/integration_tests/blockstack_integration_tests/scenarios/testlib.py @@ -1725,7 +1725,20 @@ def blockstack_cli_datastore_getfile( datastore_id, path, config_path=None, forc args.path = path args.force = '1' if force else '0' - return cli_datastore_getfile( args, config_path=config_path, interactive=interactive ) + data = cli_datastore_getfile( args, config_path=config_path, interactive=interactive ) + + # backwards-compatibility + if json_is_error(data): + return data + + else: + return { + 'status': True, + 'file': { + 'idata': data + }, + } + def blockstack_cli_datastore_putfile( datastore_privkey, path, data, data_path=None, interactive=False, force=False, proxy=None, config_path=None): @@ -2014,6 +2027,18 @@ def blockstack_REST_call( method, route, session, api_pass=None, app_fqu=None, a } +def blockstack_test_setenv(key, value): + """ + Set an environment variable on a running API daemon via the test interface + """ + res = blockstack_REST_call('POST', '/v1/test/envar?{}={}'.format(urllib.quote(key), urllib.quote(value)), None) + if res['http_status'] != 200: + res['error'] = 'Failed to issue test RPC call' + return res + + return res + + def blockstack_verify_database( consensus_hash, consensus_block_id, db_path, working_db_path=None, start_block=None ): return blockstackd.verify_database( consensus_hash, consensus_block_id, db_path, working_db_path=working_db_path, start_block=start_block )