Skip to content

Commit

Permalink
chore: support test_settings for pytest
Browse files Browse the repository at this point in the history
Due to the way the regular settings are made, test_settings also relies
 on the use of globals() to update the settings.
  • Loading branch information
voneiden committed Jan 3, 2024
1 parent 549f79c commit e53a794
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions kerrokantasi/settings/test_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from . import * # noqa

# Using globals() to avoid issues with type checking which most likely
# can not follow the use of globals().update in the settings.__init__

OIDC_API_TOKEN_AUTH = globals()["OIDC_API_TOKEN_AUTH"]
OIDC_API_TOKEN_AUTH["API_AUTHORIZATION_FIELD"] = "authorization.permissions.scopes"
OIDC_API_TOKEN_AUTH["OIDC_API_ISSUER"] = "http://test.local:8000/openid"
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ max-line-length = 120
max-complexity = 10

[tool:pytest]
DJANGO_SETTINGS_MODULE = kerrokantasi.settings
DJANGO_SETTINGS_MODULE = kerrokantasi.settings.test_settings
norecursedirs = bower_components node_modules .git venv

0 comments on commit e53a794

Please sign in to comment.