-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid recursive include of DEFAULT_SETTINGS, add sanity test (#13236)
* Avoid recursive include of DEFAULT_SETTINGS, add sanity test to avoid similar surprises * Implement review comments for more clear code order and readability * Clarify comment about order of app name, which is last in order so that it can modify user settings
- Loading branch information
1 parent
c10ada6
commit 0867221
Showing
3 changed files
with
62 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,31 @@ | ||
from split_settings.tools import include | ||
|
||
|
||
LOCAL_SETTINGS = ( | ||
'ALLOWED_HOSTS', | ||
'BROADCAST_WEBSOCKET_PORT', | ||
'BROADCAST_WEBSOCKET_VERIFY_CERT', | ||
'BROADCAST_WEBSOCKET_PROTOCOL', | ||
'BROADCAST_WEBSOCKET_SECRET', | ||
'DATABASES', | ||
'DEBUG', | ||
'NAMED_URL_GRAPH', | ||
) | ||
|
||
|
||
def test_postprocess_auth_basic_enabled(): | ||
locals().update({'__file__': __file__}) | ||
|
||
include('../../../settings/defaults.py', scope=locals()) | ||
assert 'awx.api.authentication.LoggedBasicAuthentication' in locals()['REST_FRAMEWORK']['DEFAULT_AUTHENTICATION_CLASSES'] | ||
|
||
|
||
def test_default_settings(): | ||
from django.conf import settings | ||
|
||
for k in dir(settings): | ||
if k not in settings.DEFAULTS_SNAPSHOT or k in LOCAL_SETTINGS: | ||
continue | ||
default_val = getattr(settings.default_settings, k, None) | ||
snapshot_val = settings.DEFAULTS_SNAPSHOT[k] | ||
assert default_val == snapshot_val, f'Setting for {k} does not match shapshot:\nsnapshot: {snapshot_val}\ndefault: {default_val}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters