From 42e53e84e1ae27d09eae8c7c26b7d5ca152f9cb7 Mon Sep 17 00:00:00 2001 From: steve-chavez Date: Tue, 5 May 2026 15:03:36 -0500 Subject: [PATCH] test: invalid rpc call contains role in logs --- test/io/test_io.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/io/test_io.py b/test/io/test_io.py index 2baad6074..f56346e97 100644 --- a/test/io/test_io.py +++ b/test/io/test_io.py @@ -1047,6 +1047,22 @@ def test_expired_jwt_log_lacks_role(defaultenv): ) +def test_invalid_rpc_method_log_contains_role(defaultenv): + "Invalid RPC method requests are logged with the anonymous role." + + with run(env=defaultenv) as postgrest: + response = postgrest.session.put("/rpc/sleep") + assert response.status_code == 405 + + output = postgrest.read_stdout(nlines=1) + + assert len(output) == 1 + assert re.match( + r'- - postgrest_test_anonymous \[.+\] "PUT /rpc/sleep HTTP/1.1" 405 \d+ "" "python-requests/.+"', + output[0], + ) + + def test_no_pool_connection_required_on_bad_http_logic(defaultenv): "no pool connection should be consumed for failing on invalid http logic"