beekeeper | Behavior of beekeeper after deletion of wallet from drive
We have a test, that checks if it is possible to sign with a key from the wallet that has been removed from the hard drive, but it was not closed in Beekeeper:
async def test_api_sign_digest_with_deleted_wallet(beekeeper: Beekeeper, wallet: WalletInfo) -> None:
"""Test test_api_sign_digest will test beekeeper_api.sign_digest will try to sign digest with key in a wallet that has been deleted."""
await beekeeper.api.import_key(wallet_name=wallet.name, wif_key=PRIVATE_KEY)
signature = (await beekeeper.api.sign_digest(sig_digest=DIGEST_TO_SIGN, public_key=PUBLIC_KEY)).signature
assert signature == EXPECTED_SIGNATURE, "Signatures should match."
wallet_path = beekeeper.get_wallet_dir() / f"{wallet.name}.wallet"
assert wallet_path.exists() is True, "Wallet should exists."
wallet_path.unlink()
assert wallet_path.exists() is False, "Wallet should not exists."
signature = (await beekeeper.api.sign_digest(sig_digest=DIGEST_TO_SIGN, public_key=PUBLIC_KEY)).signature
assert signature == EXPECTED_SIGNATURE, "Signatures should match."
Now, we can sign without any problems.
But should it be like this?