Skip to content

Commit c9be3d4

Browse files
committed
fix: test wrong
1 parent 65d33e7 commit c9be3d4

File tree

1 file changed

+31
-7
lines changed

1 file changed

+31
-7
lines changed

tests/test_zarr_ipfs.py

+31-7
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,23 @@ def test_authenticated_gateway(random_zarr_dataset: tuple[str, xr.Dataset]):
168168
loaded_ds = xr.open_zarr(store=hamt)
169169
xr.testing.assert_identical(loaded_ds, expected_ds)
170170

171-
# # Test with just bearer_token key
171+
# Test with wrong API Key
172+
with pytest.raises(Exception):
173+
hamt = HAMT(
174+
store=IPFSStore(
175+
rpc_uri_stem = "http://127.0.0.1:5002",
176+
api_key="badKey",
177+
),
178+
transformer_encode=encrypt,
179+
transformer_decode=decrypt,
180+
)
181+
182+
183+
# Test with just bearer_token key
172184
hamt = HAMT(
173185
store=IPFSStore(
174186
bearer_token="test",
187+
rpc_uri_stem = "http://127.0.0.1:5002",
175188
),
176189
transformer_encode=encrypt,
177190
transformer_decode=decrypt,
@@ -182,10 +195,22 @@ def test_authenticated_gateway(random_zarr_dataset: tuple[str, xr.Dataset]):
182195
loaded_ds = xr.open_zarr(store=hamt)
183196
xr.testing.assert_identical(loaded_ds, expected_ds)
184197

185-
# # Test with just basic auth
198+
# Test with wrong bearer
199+
with pytest.raises(Exception):
200+
hamt = HAMT(
201+
store=IPFSStore(
202+
bearer_token="wrongBearer",
203+
rpc_uri_stem = "http://127.0.0.1:5002",
204+
),
205+
transformer_encode=encrypt,
206+
transformer_decode=decrypt,
207+
)
208+
209+
# Test with just basic auth
186210
hamt = HAMT(
187211
store=IPFSStore(
188212
basic_auth=("test", "test"),
213+
rpc_uri_stem = "http://127.0.0.1:5002",
189214
),
190215
transformer_encode=encrypt,
191216
transformer_decode=decrypt,
@@ -196,13 +221,12 @@ def test_authenticated_gateway(random_zarr_dataset: tuple[str, xr.Dataset]):
196221
loaded_ds = xr.open_zarr(store=hamt)
197222
xr.testing.assert_identical(loaded_ds, expected_ds)
198223

199-
200-
# Test with wrong API Key
224+
# Test with wrong basic auth
201225
with pytest.raises(Exception):
202226
hamt = HAMT(
203-
store=IPFSStore(
204-
rpc_uri_stem = "http://127.0.0.1:5002",
205-
api_key="badKey",
227+
store=IPFSStore(
228+
basic_auth=("wrong", "wrong"),
229+
rpc_uri_stem = "http://127.0.0.1:5002",
206230
),
207231
transformer_encode=encrypt,
208232
transformer_decode=decrypt,

0 commit comments

Comments
 (0)