def test_get_categorised_files(mock_listdir, pathlist, results) -> None: mock_listdir.return_value = pathlist assert get_categorised_files("...") == results
'xpub661MyMwAqRbcGfCPEkkyo5WmcrhTq8mi3xuBS7VEZ3LYvsgY1cCFDben' + 'T33bdD12axvrmXhuX3xkAbKci3yZY9ZEk8vhLic7KNhLjqdh5ec') keystores = [ks1, ks2] keystore_usages = [] for i, k in enumerate(keystores): keystore_usage = parent_wallet.add_keystore(k.dump()) keystore_usage['name'] = f'x{i+1}/' keystore_usages.append(keystore_usage) child_wallet = Multisig_Wallet.create_within_parent( parent_wallet, keystore_usage=keystore_usages, wallet_type="2of2") check_legacy_parent_of_multisig_wallet(parent_wallet) @pytest.mark.parametrize("storage_info", get_categorised_files(TEST_WALLET_PATH)) def test_legacy_wallet_loading(storage_info: WalletStorageInfo) -> None: # When a wallet is composed of multiple files, we need to know which to load. wallet_filenames = [] if storage_info.kind != StorageKind.DATABASE: wallet_filenames.append(storage_info.filename) if storage_info.kind in (StorageKind.DATABASE, StorageKind.HYBRID): wallet_filenames.append(storage_info.filename + DATABASE_EXT) temp_dir = tempfile.mkdtemp() for _wallet_filename in wallet_filenames: source_wallet_path = os.path.join(TEST_WALLET_PATH, _wallet_filename) wallet_path = os.path.join(temp_dir, _wallet_filename) shutil.copyfile(source_wallet_path, wallet_path) wallet_filename = storage_info.filename
def get_categorised_files2(wallet_path: str) -> List[WalletStorageInfo]: matches = get_categorised_files(wallet_path) # In order to ensure ordering consistency, we sort the files. return sorted(matches, key=lambda v: v.filename)