Skip to content

Commit 99a7f53

Browse files
committed
fix(tests): small fix
1 parent 0b1a304 commit 99a7f53

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "cardo-python-utils"
7-
version = "0.5.dev36"
7+
version = "0.5.dev37"
88
description = "Python library enhanced with a wide range of functions for different scenarios."
99
readme = "README.rst"
1010
requires-python = ">=3.8"

python_utils/django/README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,17 @@ MIDDLEWARE = [
3535

3636
# Include the database configuration for each tenant in the DATABASES setting.
3737
# You can use the get_database_configs() function from python_utils.django.db.utils as a helper.
38-
DATABASES = {
39-
'tenant1': { ... },
40-
'tenant2': { ... },
41-
...
42-
}
38+
from python_utils.django.db.utils import get_database_configs
39+
40+
for tenant, tenant_db_config in get_database_configs().items():
41+
DATABASES[tenant] = {
42+
"ENGINE": "django.db.backends.postgresql",
43+
"NAME": tenant_db_config["name"],
44+
"USER": tenant_db_config["user"],
45+
"PASSWORD": tenant_db_config["password"],
46+
"HOST": tenant_db_config["host"],
47+
"PORT": tenant_db_config.get("port", 5432),
48+
}
4349

4450
# If you want to override the database alias to use for local development (when DEBUG is True).
4551
# By default, the first database defined in DATABASES is used.

python_utils/django/tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def mock_verify_scopes_ninja():
8080
Patches AuthBearer._verify_scopes, so that no real scope checking is done during tests.
8181
This is done because scope checking uses route resolution, which the test client does not support.
8282
"""
83-
with patch("python_utils.keycloak.django.api.ninja.AuthBearer._verify_scopes") as mock_verify:
83+
with patch("python_utils.django.api.ninja.AuthBearer._verify_scopes") as mock_verify:
8484
mock_verify.return_value = None
8585
yield mock_verify
8686

0 commit comments

Comments
 (0)