From 0a24a83fa947ce65a6b4bfd8b2d1efc80fec0473 Mon Sep 17 00:00:00 2001 From: Robert Vollmert Date: Tue, 2 Aug 2022 10:21:48 +0200 Subject: [PATCH] tests: decouple config tests from test-specific postgrest settings --- test/io/test_io.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/test/io/test_io.py b/test/io/test_io.py index 753ec3a36..f755b7852 100644 --- a/test/io/test_io.py +++ b/test/io/test_io.py @@ -86,12 +86,20 @@ def dburi(): @pytest.fixture -def defaultenv(): - "Default environment for PostgREST." +def baseenv(): + "Base environment to connect to PostgreSQL" return { "PGDATABASE": os.environ["PGDATABASE"], "PGHOST": os.environ["PGHOST"], "PGUSER": os.environ["PGUSER"], + } + + +@pytest.fixture +def defaultenv(baseenv): + "Default environment for PostgREST." + return { + **baseenv, "PGRST_DB_CONFIG": "true", "PGRST_LOG_LEVEL": "info", } @@ -345,13 +353,13 @@ def test_expected_config_from_environment(): ("other_authenticator", "no-defaults-with-db-other-authenticator.config"), ], ) -def test_expected_config_from_db_settings(defaultenv, role, expectedconfig): +def test_expected_config_from_db_settings(baseenv, role, expectedconfig): "Config should be overriden from database settings" config = CONFIGSDIR / "no-defaults.config" env = { - **defaultenv, + **baseenv, "PGUSER": role, "PGRST_DB_URI": "postgresql://", "PGRST_DB_CONFIG": "true",