From ca0bb96808198750307a4d94879e88256204022b Mon Sep 17 00:00:00 2001 From: Jon Date: Fri, 4 Apr 2025 14:07:18 +0930 Subject: [PATCH] test: During testing add debug_feature_flags so object behind can be tested ref: #707 --- app/app/settings.py | 5 ++++- app/centurion_feature_flag/lib/feature_flag.py | 9 ++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/app/settings.py b/app/app/settings.py index 989761be..626ebe56 100644 --- a/app/app/settings.py +++ b/app/app/settings.py @@ -500,7 +500,10 @@ if FEATURE_FLAGGING_ENABLED: 'over_rides': FEATURE_FLAG_OVERRIDES }) - if DEBUG: + + if DEBUG or RUNNING_TESTS: + + feature_flag.update({ 'disable_downloading': True, }) debug_feature_flags = [ { diff --git a/app/centurion_feature_flag/lib/feature_flag.py b/app/centurion_feature_flag/lib/feature_flag.py index 4e722878..ae87b03d 100644 --- a/app/centurion_feature_flag/lib/feature_flag.py +++ b/app/centurion_feature_flag/lib/feature_flag.py @@ -112,6 +112,10 @@ class CenturionFeatureFlagging: self._disable_downloading = disable_downloading + if self._disable_downloading: + + self._feature_flags = {} + _over_rides: dict = {} if over_rides: @@ -183,7 +187,10 @@ class CenturionFeatureFlagging: Returns: dict: A complete Feature Flag. """ - if self._feature_flags is None: + if( + self._feature_flags is None + and self._over_rides.get(key, None) is None + ): print('Feature Flagging has not been completly initialized.') print(' please ensure that the feature flags have been downloaded.')