From 59ca9e7f0d4a8a7596764b75bb98d682c2222482 Mon Sep 17 00:00:00 2001 From: Taimoor Zaeem Date: Thu, 11 Sep 2025 19:18:01 +0500 Subject: [PATCH] test(io): move jwt secret length test to test_cli.py Closes #4316. Signed-off-by: Taimoor Zaeem --- test/io/test_cli.py | 9 +++++++++ test/io/test_io.py | 13 ------------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/test/io/test_cli.py b/test/io/test_cli.py index d5bfc9a68..4609e8075 100644 --- a/test/io/test_cli.py +++ b/test/io/test_cli.py @@ -294,3 +294,12 @@ def test_jwt_aud_config_set_to_invalid_uri(defaultenv): error = cli(["--dump-config"], env=env, expect_error=True) assert "jwt-aud should be a string or a valid URI" in error + + +def test_jwt_secret_min_length(defaultenv): + "Should log error and not load the config when the secret is shorter than the minimum admitted length" + + env = {**defaultenv, "PGRST_JWT_SECRET": "short_secret"} + + error = cli(["--dump-config"], env=env, expect_error=True) + assert "The JWT secret must be at least 32 characters long." in error diff --git a/test/io/test_io.py b/test/io/test_io.py index 41ff522ef..b07efc6c2 100644 --- a/test/io/test_io.py +++ b/test/io/test_io.py @@ -66,19 +66,6 @@ def test_read_secret_from_stdin_dbconfig(defaultenv): assert response.status_code == 200 -def test_secret_min_length(defaultenv): - "Should log error and not load the config when the secret is shorter than the minimum admitted length" - - env = {**defaultenv, "PGRST_JWT_SECRET": "short_secret"} - - with run(env=env, no_startup_stdout=False, wait_for_readiness=False) as postgrest: - exitCode = wait_until_exit(postgrest) - assert exitCode == 1 - - output = postgrest.read_stdout(nlines=1) - assert "The JWT secret must be at least 32 characters long." in output[0] - - def test_jwt_errors(defaultenv): "invalid JWT should throw error"