Skip to content

Commit 42e53e8

Browse files
committed
test: invalid rpc call contains role in logs
1 parent 8105375 commit 42e53e8

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

test/io/test_io.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,6 +1047,22 @@ def test_expired_jwt_log_lacks_role(defaultenv):
10471047
)
10481048

10491049

1050+
def test_invalid_rpc_method_log_contains_role(defaultenv):
1051+
"Invalid RPC method requests are logged with the anonymous role."
1052+
1053+
with run(env=defaultenv) as postgrest:
1054+
response = postgrest.session.put("/rpc/sleep")
1055+
assert response.status_code == 405
1056+
1057+
output = postgrest.read_stdout(nlines=1)
1058+
1059+
assert len(output) == 1
1060+
assert re.match(
1061+
r'- - postgrest_test_anonymous \[.+\] "PUT /rpc/sleep HTTP/1.1" 405 \d+ "" "python-requests/.+"',
1062+
output[0],
1063+
)
1064+
1065+
10501066
def test_no_pool_connection_required_on_bad_http_logic(defaultenv):
10511067
"no pool connection should be consumed for failing on invalid http logic"
10521068

0 commit comments

Comments
 (0)