test(io): move jwt secret length test to test_cli.py

Closes #4316.

Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
This commit is contained in:
Taimoor Zaeem
2025-09-11 12:01:21 -05:00
committed by Steve Chavez
parent cddfb6cf5e
commit 59ca9e7f0d
2 changed files with 9 additions and 13 deletions
+9
View File
@@ -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
-13
View File
@@ -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"