Skip to content

Commit e1c768e

Browse files
committed
Include coinbase address in fixture json
Needed for parity --unlock CLI
1 parent 7ebf54a commit e1c768e

File tree

1 file changed

+31
-16
lines changed

1 file changed

+31
-16
lines changed

tests/integration/test_parity.py

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import json
21
import os
32
import pytest
43
import shutil
@@ -29,8 +28,25 @@
2928

3029
KEYFILE_PW = 'web3py-test'
3130

32-
PARITY_FIXTURE = {
31+
PARITY_1_8_8_FIXTURE = {
32+
'datadir': 'parity-188-fixture',
33+
'coinbase': 'dc544d1aa88ff8bbd2f2aec754b1f1e99e1812fd',
34+
'block_hash_with_log': '0x342e12ab6d24d7fb1d774a6b47cd2cc04430a3295bee5662d5a1a0b766480031',
35+
'block_with_txn_hash': '0xa866266a5a348948c38855cc6e990093b35a3d2c43fdddfe3b1259c9c3fc7404',
36+
'emitter_address': '0x4aA591a07989b4F810E2F5cE97e769D60710f168',
37+
'emitter_deploy_txn_hash': '0xa81e903e9953758c8da5aaae66451ff909edd7bd6aefc3ebeab1e709e3229bcc',
38+
'empty_block_hash': '0xbcb2826e4376c23e66750607af72965f177f93b39e5024be259e6b0ff4f95e9d',
39+
'keyfile_pw': 'web3py-test',
40+
'math_address': '0xd794C821fCCFF5D96F5Db44af7e29977630A9dc2',
41+
'math_deploy_txn_hash': '0x03cc47c8f58608576187825aed01c4fc64786f1172d182d432336881a75a0fa3',
42+
'mined_txn_hash': '0x9839fde5fce7f0ed29b49a687d4f7630076069e65c2e1df87ffab9b2844d3899',
43+
'raw_txn_account': '0x39EEed73fb1D3855E90Cbd42f348b3D7b340aAA6',
44+
'txn_hash_with_log': '0x26bad3318b3466833f96d04ac9ba46fbbce11c15be2f83c9fe0b5dc15b2646cd'
45+
}
46+
47+
PARITY_1_8_7_FIXTURE = {
3348
'datadir': 'parity-187-fixture',
49+
'coinbase': 'dc544d1aa88ff8bbd2f2aec754b1f1e99e1812fd',
3450
'block_hash_with_log': '0x342e12ab6d24d7fb1d774a6b47cd2cc04430a3295bee5662d5a1a0b766480031',
3551
'block_with_txn_hash': '0xa866266a5a348948c38855cc6e990093b35a3d2c43fdddfe3b1259c9c3fc7404',
3652
'emitter_address': '0x4aA591a07989b4F810E2F5cE97e769D60710f168',
@@ -66,7 +82,12 @@ def get_parity_version(parity_binary):
6682

6783
@pytest.fixture(scope="session")
6884
def parity_fixture_data(parity_binary):
69-
return PARITY_FIXTURE
85+
if os.path.basename(parity_binary) == 'parity-1_8_7':
86+
return PARITY_1_8_7_FIXTURE
87+
elif os.path.basename(parity_binary) == 'parity-1_8_8':
88+
return PARITY_1_8_7_FIXTURE
89+
else:
90+
return PARITY_1_8_7_FIXTURE
7091

7192

7293
@pytest.fixture(scope='session')
@@ -82,13 +103,10 @@ def datadir(tmpdir_factory, parity_fixture_data):
82103

83104

84105
@pytest.fixture(scope="session")
85-
def accounts(datadir):
106+
def author(parity_fixture_data):
86107
# need the address to unlock before web3 session has been opened
87-
chain_config_path = os.path.join(datadir, "chain_config.json")
88-
with open(chain_config_path, 'r') as f:
89-
chain_config = json.load(f)
90-
accounts = chain_config['accounts'].keys()
91-
return accounts
108+
author = parity_fixture_data['coinbase']
109+
return author
92110

93111

94112
@pytest.fixture(scope='session')
@@ -133,15 +151,14 @@ def parity_process(
133151
parity_binary,
134152
ipc_path, datadir,
135153
passwordfile,
136-
accounts):
137-
coinbase = list(accounts)[0]
154+
author):
138155

139156
run_parity_command = (
140157
parity_binary,
141158
'--chain', os.path.join(datadir, 'chain_config.json'),
142159
'--ipc-path', ipc_path,
143160
'--base-path', str(datadir),
144-
'--unlock', coinbase,
161+
'--unlock', str(author),
145162
'--password', str(passwordfile),
146163
)
147164
proc = subprocess.Popen(
@@ -167,16 +184,14 @@ def parity_process(
167184

168185

169186
@pytest.fixture(scope="session")
170-
def parity_import_blocks_process(parity_binary, ipc_path, datadir, passwordfile, accounts):
171-
coinbase = list(accounts)[0]
172-
187+
def parity_import_blocks_process(parity_binary, ipc_path, datadir, passwordfile):
173188
run_parity_command = (
174189
parity_binary,
175190
'import', os.path.join(datadir, 'blocks_export.rlp'),
176191
'--chain', os.path.join(datadir, 'chain_config.json'),
177192
'--ipc-path', ipc_path,
178193
'--base-path', str(datadir),
179-
'--unlock', coinbase,
194+
'--unlock', str(author),
180195
'--password', str(passwordfile),
181196
)
182197
proc = subprocess.Popen(

0 commit comments

Comments
 (0)