tests: decouple config tests from test-specific postgrest settings
This commit is contained in:
+12
-4
@@ -86,12 +86,20 @@ def dburi():
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def defaultenv():
|
def baseenv():
|
||||||
"Default environment for PostgREST."
|
"Base environment to connect to PostgreSQL"
|
||||||
return {
|
return {
|
||||||
"PGDATABASE": os.environ["PGDATABASE"],
|
"PGDATABASE": os.environ["PGDATABASE"],
|
||||||
"PGHOST": os.environ["PGHOST"],
|
"PGHOST": os.environ["PGHOST"],
|
||||||
"PGUSER": os.environ["PGUSER"],
|
"PGUSER": os.environ["PGUSER"],
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def defaultenv(baseenv):
|
||||||
|
"Default environment for PostgREST."
|
||||||
|
return {
|
||||||
|
**baseenv,
|
||||||
"PGRST_DB_CONFIG": "true",
|
"PGRST_DB_CONFIG": "true",
|
||||||
"PGRST_LOG_LEVEL": "info",
|
"PGRST_LOG_LEVEL": "info",
|
||||||
}
|
}
|
||||||
@@ -345,13 +353,13 @@ def test_expected_config_from_environment():
|
|||||||
("other_authenticator", "no-defaults-with-db-other-authenticator.config"),
|
("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 should be overriden from database settings"
|
||||||
|
|
||||||
config = CONFIGSDIR / "no-defaults.config"
|
config = CONFIGSDIR / "no-defaults.config"
|
||||||
|
|
||||||
env = {
|
env = {
|
||||||
**defaultenv,
|
**baseenv,
|
||||||
"PGUSER": role,
|
"PGUSER": role,
|
||||||
"PGRST_DB_URI": "postgresql://",
|
"PGRST_DB_URI": "postgresql://",
|
||||||
"PGRST_DB_CONFIG": "true",
|
"PGRST_DB_CONFIG": "true",
|
||||||
|
|||||||
Reference in New Issue
Block a user