1212from consensus_decentralization .mappings .ethereum_mapping import EthereumMapping
1313from consensus_decentralization .mappings .cardano_mapping import CardanoMapping
1414from consensus_decentralization .mappings .tezos_mapping import TezosMapping
15- from consensus_decentralization .helper import RAW_DATA_DIR , INTERIM_DIR , get_clustering_flag
15+ from consensus_decentralization .helper import INTERIM_DIR , get_clustering_flag , get_input_directories
1616
1717
1818@pytest .fixture
@@ -31,7 +31,7 @@ def setup_and_cleanup():
3131 ledger_parser ['sample_cardano' ] = DummyParser
3232 ledger_mapping ['sample_tezos' ] = TezosMapping
3333 ledger_parser ['sample_tezos' ] = DummyParser
34- test_raw_data_dir = RAW_DATA_DIR
34+ test_raw_data_dirs = get_input_directories ()
3535 test_output_dir = INTERIM_DIR / "test_output"
3636 # Create the output directory for each project (as this is typically done in the run.py script before parsing or
3737 # mapping takes place)
@@ -41,7 +41,7 @@ def setup_and_cleanup():
4141 mapping_info_dir = pathlib .Path (__file__ ).resolve ().parent .parent / 'mapping_information'
4242 # Mock return value of get_clustering_flag
4343 get_clustering_flag .return_value = True
44- yield mapping_info_dir , test_raw_data_dir , test_output_dir
44+ yield mapping_info_dir , test_raw_data_dirs , test_output_dir
4545 # Clean up
4646 shutil .rmtree (test_output_dir )
4747
@@ -95,24 +95,24 @@ def prep_sample_tezos_mapping_info():
9595
9696
9797def test_map (setup_and_cleanup , prep_sample_bitcoin_mapping_info ):
98- mapping_info_dir , test_raw_data_dir , test_output_dir = setup_and_cleanup
98+ mapping_info_dir , test_raw_data_dirs , test_output_dir = setup_and_cleanup
9999
100- parsed_data = parse (project = 'sample_bitcoin' , input_dir = test_raw_data_dir )
100+ parsed_data = parse (ledger = 'sample_bitcoin' , input_dirs = test_raw_data_dirs )
101101 apply_mapping (project = 'sample_bitcoin' , parsed_data = parsed_data , output_dir = test_output_dir )
102102
103103 mapped_data_file = test_output_dir / 'sample_bitcoin/mapped_data_clustered.json'
104104 assert mapped_data_file .is_file ()
105105
106106
107107def test_bitcoin_mapping (setup_and_cleanup , prep_sample_bitcoin_mapping_info ):
108- mapping_info_dir , test_raw_data_dir , test_output_dir = setup_and_cleanup
108+ mapping_info_dir , test_raw_data_dirs , test_output_dir = setup_and_cleanup
109109 with open (mapping_info_dir / 'addresses/sample_bitcoin.json' ) as f :
110110 pool_addresses = json .load (f )
111111 pool_addresses ['0000000000000000000000000000000000000000' ] = {'name' : 'TEST2' , 'source' : '' }
112112 with open (mapping_info_dir / 'addresses/sample_bitcoin.json' , 'w' ) as f :
113113 f .write (json .dumps (pool_addresses ))
114114
115- parsed_data = parse (project = 'sample_bitcoin' , input_dir = test_raw_data_dir )
115+ parsed_data = parse (ledger = 'sample_bitcoin' , input_dirs = test_raw_data_dirs )
116116 apply_mapping (project = 'sample_bitcoin' , parsed_data = parsed_data , output_dir = test_output_dir )
117117
118118 expected_block_creators = {
@@ -136,15 +136,15 @@ def test_bitcoin_mapping(setup_and_cleanup, prep_sample_bitcoin_mapping_info):
136136
137137
138138def test_ethereum_mapping (setup_and_cleanup , prep_sample_ethereum_mapping_info ):
139- mapping_info_dir , test_raw_data_dir , test_output_dir = setup_and_cleanup
139+ mapping_info_dir , test_raw_data_dirs , test_output_dir = setup_and_cleanup
140140
141141 with open (mapping_info_dir / 'addresses/sample_ethereum.json' ) as f :
142142 addresses = json .load (f )
143143 addresses ['0xe9b54a47e3f401d37798fc4e22f14b78475c2afc' ] = {'name' : 'TEST2' , 'source' : '' }
144144 with open (mapping_info_dir / 'addresses/sample_ethereum.json' , 'w' ) as f :
145145 f .write (json .dumps (addresses ))
146146
147- parsed_data = parse (project = 'sample_ethereum' , input_dir = test_raw_data_dir )
147+ parsed_data = parse (ledger = 'sample_ethereum' , input_dirs = test_raw_data_dirs )
148148 apply_mapping (project = 'sample_ethereum' , parsed_data = parsed_data , output_dir = test_output_dir )
149149
150150 expected_block_creators = {
@@ -169,9 +169,9 @@ def test_ethereum_mapping(setup_and_cleanup, prep_sample_ethereum_mapping_info):
169169
170170
171171def test_cardano_mapping (setup_and_cleanup , prep_sample_cardano_mapping_info ):
172- mapping_info_dir , test_raw_data_dir , test_output_dir = setup_and_cleanup
172+ mapping_info_dir , test_raw_data_dirs , test_output_dir = setup_and_cleanup
173173
174- parsed_data = parse (project = 'sample_cardano' , input_dir = test_raw_data_dir )
174+ parsed_data = parse (ledger = 'sample_cardano' , input_dirs = test_raw_data_dirs )
175175 apply_mapping (project = 'sample_cardano' , parsed_data = parsed_data , output_dir = test_output_dir )
176176
177177 expected_block_creators = {
@@ -193,9 +193,9 @@ def test_cardano_mapping(setup_and_cleanup, prep_sample_cardano_mapping_info):
193193
194194
195195def test_tezos_mapping (setup_and_cleanup , prep_sample_tezos_mapping_info ):
196- mapping_info_dir , test_raw_data_dir , test_output_dir = setup_and_cleanup
196+ mapping_info_dir , test_raw_data_dirs , test_output_dir = setup_and_cleanup
197197
198- parsed_data = parse (project = 'sample_tezos' , input_dir = test_raw_data_dir )
198+ parsed_data = parse (ledger = 'sample_tezos' , input_dirs = test_raw_data_dirs )
199199 apply_mapping (project = 'sample_tezos' , parsed_data = parsed_data , output_dir = test_output_dir )
200200
201201 expected_block_creators = {
0 commit comments