def test_textstore_load_data_valid(tmp_path) -> None: wallet_path = os.path.join(tmp_path, "wallet") store = TextStore(wallet_path) try: store.load_data(b"{}") finally: store.close()
def test_textstore_load_data_valid() -> None: wallet_path = tempfile.mktemp() store = TextStore(wallet_path) try: store.load_data(b"{}") finally: store.close()
def test_store_load_data_invalid(tmp_path) -> None: wallet_path = os.path.join(tmp_path, "wallet") store = TextStore(wallet_path) try: with pytest.raises(OSError): store.load_data(b"x{}") finally: store.close()
def test_store_load_data_invalid() -> None: wallet_path = tempfile.mktemp() store = TextStore(wallet_path) try: with pytest.raises(OSError): store.load_data(b"x{}") finally: store.close()
def test_store__write(tmp_path) -> None: wallet_path = os.path.join(tmp_path, "wallet") store = TextStore(wallet_path) try: assert not store.is_primed() store.put("number", 10) store._write() assert store.is_primed() # This will raise an assertion if there is not locatible JSON lump. store._read_raw_data() assert store.get("number") == 10 finally: store.close() store = TextStore(wallet_path) try: assert store.is_primed() # We need to do this here because the wallet storage normally does it. store.load_data(store._read_raw_data()) assert store.get("number") == 10 finally: store.close()