mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
refactor: "regtest" -> self.chain
This commit is contained in:
parent
596fd4bfca
commit
5a48c8b322
@ -18,7 +18,7 @@ class BlocksdirTest(BitcoinTestFramework):
|
||||
|
||||
def run_test(self):
|
||||
self.stop_node(0)
|
||||
assert os.path.isdir(os.path.join(self.nodes[0].datadir, "regtest", "blocks"))
|
||||
assert os.path.isdir(os.path.join(self.nodes[0].datadir, self.chain, "blocks"))
|
||||
assert not os.path.isdir(os.path.join(self.nodes[0].datadir, "blocks"))
|
||||
shutil.rmtree(self.nodes[0].datadir)
|
||||
initialize_datadir(self.options.tmpdir, 0, self.chain)
|
||||
|
@ -69,7 +69,7 @@ class ToolWalletTest(BitcoinTestFramework):
|
||||
self.assert_raises_tool_error('Invalid command: help', 'help')
|
||||
self.assert_raises_tool_error('Error: two methods provided (info and create). Only one method should be provided.', 'info', 'create')
|
||||
self.assert_raises_tool_error('Error parsing command line arguments: Invalid parameter -foo', '-foo')
|
||||
locked_dir = os.path.join(self.options.tmpdir, "node0", "regtest", "wallets")
|
||||
locked_dir = os.path.join(self.options.tmpdir, "node0", self.chain, "wallets")
|
||||
error = "SQLiteDatabase: Unable to obtain an exclusive lock on the database, is it being used by another dashd?"
|
||||
if self.is_bdb_compiled():
|
||||
error = 'Error initializing wallet database environment "{}"!'.format(locked_dir)
|
||||
@ -78,7 +78,7 @@ class ToolWalletTest(BitcoinTestFramework):
|
||||
'-wallet=' + self.default_wallet_name,
|
||||
'info',
|
||||
)
|
||||
path = os.path.join(self.options.tmpdir, "node0", "regtest", "wallets", "nonexistent.dat")
|
||||
path = os.path.join(self.options.tmpdir, "node0", self.chain, "wallets", "nonexistent.dat")
|
||||
self.assert_raises_tool_error("Failed to load database path '{}'. Path does not exist.".format(path), '-wallet=nonexistent.dat', 'info')
|
||||
|
||||
def test_tool_wallet_info(self):
|
||||
|
@ -277,11 +277,11 @@ class MultiWalletTest(BitcoinTestFramework):
|
||||
assert_equal(set(self.nodes[0].listwallets()), set(wallet_names))
|
||||
|
||||
# Fail to load if wallet doesn't exist
|
||||
path = os.path.join(self.options.tmpdir, "node0", "regtest", "wallets", "wallets")
|
||||
path = os.path.join(self.options.tmpdir, "node0", self.chain, "wallets", "wallets")
|
||||
assert_raises_rpc_error(-18, "Wallet file verification failed. Failed to load database path '{}'. Path does not exist.".format(path), self.nodes[0].loadwallet, 'wallets')
|
||||
|
||||
# Fail to load duplicate wallets
|
||||
path = os.path.join(self.options.tmpdir, "node0", "regtest", "wallets", "w1", self.wallet_data_filename)
|
||||
path = os.path.join(self.options.tmpdir, "node0", self.chain, "wallets", "w1", self.wallet_data_filename)
|
||||
if self.options.is_sqlite_only:
|
||||
assert_raises_rpc_error(-4, "Wallet file verification failed. SQLiteDatabase: Unable to obtain an exclusive lock on the database, is it being used by another dashd?", self.nodes[0].loadwallet, wallet_names[0])
|
||||
else:
|
||||
@ -289,7 +289,7 @@ class MultiWalletTest(BitcoinTestFramework):
|
||||
|
||||
# This tests the default wallet that BDB makes, so SQLite wallet doesn't need to test this
|
||||
# Fail to load duplicate wallets by different ways (directory and filepath)
|
||||
path = os.path.join(self.options.tmpdir, "node0", "regtest", "wallets", self.wallet_data_filename)
|
||||
path = os.path.join(self.options.tmpdir, "node0", self.chain, "wallets", self.wallet_data_filename)
|
||||
assert_raises_rpc_error(-4, "Wallet file verification failed. Refusing to load database. Data file '{}' is already loaded.".format(path), self.nodes[0].loadwallet, self.wallet_data_filename)
|
||||
|
||||
# Only BDB doesn't open duplicate wallet files. SQLite does not have this limitation. While this may be desired in the future, it is not necessary
|
||||
@ -306,7 +306,7 @@ class MultiWalletTest(BitcoinTestFramework):
|
||||
self.log.info("Test dynamic wallet creation.")
|
||||
|
||||
# Fail to create a wallet if it already exists.
|
||||
path = os.path.join(self.options.tmpdir, "node0", "regtest", "wallets", "w2")
|
||||
path = os.path.join(self.options.tmpdir, "node0", self.chain, "wallets", "w2")
|
||||
assert_raises_rpc_error(-4, "Failed to create database path '{}'. Database already exists.".format(path), self.nodes[0].createwallet, 'w2')
|
||||
|
||||
# Successfully create a wallet with a new name
|
||||
@ -330,7 +330,7 @@ class MultiWalletTest(BitcoinTestFramework):
|
||||
|
||||
# Fail to load if a directory is specified that doesn't contain a wallet
|
||||
os.mkdir(wallet_dir('empty_wallet_dir'))
|
||||
path = os.path.join(self.options.tmpdir, "node0", "regtest", "wallets", "empty_wallet_dir")
|
||||
path = os.path.join(self.options.tmpdir, "node0", self.chain, "wallets", "empty_wallet_dir")
|
||||
assert_raises_rpc_error(-18, "Wallet file verification failed. Failed to load database path '{}'. Data is not in recognized format.".format(path), self.nodes[0].loadwallet, 'empty_wallet_dir')
|
||||
|
||||
self.log.info("Test dynamic wallet unloading")
|
||||
|
Loading…
Reference in New Issue
Block a user