Example #1
0
def test_text_store__write_version_incompatible() -> None:
    wallet_path = tempfile.mktemp()
    store = TextStore(wallet_path)
    try:
        store.put("seed_version", TextStore.FINAL_SEED_VERSION + 1)
        with pytest.raises(IncompatibleWalletError):
            store.write()
    finally:
        store.close()
Example #2
0
def test_textstore_read_raw_data(tmp_path) -> None:
    wallet_path = os.path.join(tmp_path, "wallet")
    store = TextStore(wallet_path)
    try:
        # No write operation has been done yet on the store.
        with pytest.raises(FileNotFoundError):
            store._read_raw_data()
        # Commit the empty JSON lump to disk.
        store.write()
        data = store._read_raw_data()
        assert data == b'{}'
        assert not store.is_encrypted()
    finally:
        store.close()