File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -339,3 +339,53 @@ def test_postgrest_can_connect_to_db(host):
339
339
},
340
340
)
341
341
assert res .ok
342
+
343
+
344
+ # There would be an error if the `apikey` query parameter isn't removed,
345
+ # since PostgREST treats query parameters as conditions.
346
+ #
347
+ # Worth testing since remove_apikey_query_parameter.lua uses regexp instead
348
+ # of parsed query parameters.
349
+ def test_postgrest_starting_apikey_query_parameter_is_removed (host ):
350
+ res = requests .get (
351
+ f"http://{ host .backend .get_hostname ()} /rest/v1/buckets" ,
352
+ headers = {
353
+ "accept-profile" : "storage" ,
354
+ },
355
+ params = {
356
+ "apikey" : service_role_key ,
357
+ "id" : "eq.absent" ,
358
+ "name" : "eq.absent" ,
359
+ },
360
+ )
361
+ assert res .ok
362
+
363
+
364
+ def test_postgrest_middle_apikey_query_parameter_is_removed (host ):
365
+ res = requests .get (
366
+ f"http://{ host .backend .get_hostname ()} /rest/v1/buckets" ,
367
+ headers = {
368
+ "accept-profile" : "storage" ,
369
+ },
370
+ params = {
371
+ "id" : "eq.absent" ,
372
+ "apikey" : service_role_key ,
373
+ "name" : "eq.absent" ,
374
+ },
375
+ )
376
+ assert res .ok
377
+
378
+
379
+ def test_postgrest_ending_apikey_query_parameter_is_removed (host ):
380
+ res = requests .get (
381
+ f"http://{ host .backend .get_hostname ()} /rest/v1/buckets" ,
382
+ headers = {
383
+ "accept-profile" : "storage" ,
384
+ },
385
+ params = {
386
+ "id" : "eq.absent" ,
387
+ "name" : "eq.absent" ,
388
+ "apikey" : service_role_key ,
389
+ },
390
+ )
391
+ assert res .ok
You can’t perform that action at this time.
0 commit comments