@@ -168,10 +168,23 @@ def test_authenticated_gateway(random_zarr_dataset: tuple[str, xr.Dataset]):
168
168
loaded_ds = xr .open_zarr (store = hamt )
169
169
xr .testing .assert_identical (loaded_ds , expected_ds )
170
170
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
172
184
hamt = HAMT (
173
185
store = IPFSStore (
174
186
bearer_token = "test" ,
187
+ rpc_uri_stem = "http://127.0.0.1:5002" ,
175
188
),
176
189
transformer_encode = encrypt ,
177
190
transformer_decode = decrypt ,
@@ -182,10 +195,22 @@ def test_authenticated_gateway(random_zarr_dataset: tuple[str, xr.Dataset]):
182
195
loaded_ds = xr .open_zarr (store = hamt )
183
196
xr .testing .assert_identical (loaded_ds , expected_ds )
184
197
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
186
210
hamt = HAMT (
187
211
store = IPFSStore (
188
212
basic_auth = ("test" , "test" ),
213
+ rpc_uri_stem = "http://127.0.0.1:5002" ,
189
214
),
190
215
transformer_encode = encrypt ,
191
216
transformer_decode = decrypt ,
@@ -196,13 +221,12 @@ def test_authenticated_gateway(random_zarr_dataset: tuple[str, xr.Dataset]):
196
221
loaded_ds = xr .open_zarr (store = hamt )
197
222
xr .testing .assert_identical (loaded_ds , expected_ds )
198
223
199
-
200
- # Test with wrong API Key
224
+ # Test with wrong basic auth
201
225
with pytest .raises (Exception ):
202
226
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 " ,
206
230
),
207
231
transformer_encode = encrypt ,
208
232
transformer_decode = decrypt ,
0 commit comments