File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1047,6 +1047,28 @@ def test_expired_jwt_log_lacks_role(defaultenv):
10471047 )
10481048
10491049
1050+ def test_log_lacks_role_with_empty_anon_role (defaultenv ):
1051+ "Requests are logged without a role when db-anon-role is empty."
1052+
1053+ env = {
1054+ ** defaultenv ,
1055+ "PGRST_DB_CONFIG" : "false" ,
1056+ "PGRST_DB_ANON_ROLE" : "" ,
1057+ }
1058+
1059+ with run (env = env ) as postgrest :
1060+ response = postgrest .session .get ("/projects" )
1061+ assert response .status_code == 401
1062+
1063+ output = postgrest .read_stdout (nlines = 1 )
1064+
1065+ assert len (output ) == 1
1066+ assert re .match (
1067+ r'- - - \[.+\] "GET /projects HTTP/1.1" 401 \d+ "" "python-requests/.+"' ,
1068+ output [0 ],
1069+ )
1070+
1071+
10501072def test_invalid_rpc_method_log_contains_role (defaultenv ):
10511073 "Invalid RPC method requests are logged with the anonymous role."
10521074
You can’t perform that action at this time.
0 commit comments