Skip to content

Commit 0c3a7a1

Browse files
committed
fix: test wrong api key
1 parent 9c32519 commit 0c3a7a1

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

tests/test_zarr_ipfs.py

+4-7
Original file line numberDiff line numberDiff line change
@@ -185,20 +185,17 @@ def test_authenticated_gateway(random_zarr_dataset: tuple[str, xr.Dataset]):
185185
# xr.testing.assert_identical(loaded_ds, expected_ds)
186186

187187

188-
# Test with just api key
188+
# Test with wrong API Key
189189
hamt = HAMT(
190190
store=IPFSStore(
191191
rpc_uri_stem = "http://127.0.0.1:5002",
192-
api_key="test",
192+
api_key="badKey",
193193
),
194194
transformer_encode=encrypt,
195195
transformer_decode=decrypt,
196196
)
197-
test_ds.to_zarr(store=hamt, mode="w")
198-
199-
hamt.make_read_only()
200-
loaded_ds = xr.open_zarr(store=hamt)
201-
xr.testing.assert_identical(loaded_ds, expected_ds)
197+
with pytest.raises(Exception):
198+
test_ds.to_zarr(store=hamt, mode="w")
202199

203200
# Now trying to load without a decryptor, xarray should be able to read the metadata and still perform operations on the unencrypted variable
204201
print("Attempting to read and print metadata of partially encrypted zarr")

0 commit comments

Comments
 (0)