Merge default feature flags and user defined feature flags

- Rename the default feature flags key in `config.py` to DEFAULT_FEATURE_FLAGS
- Merge default feature flags with user defined ones allowing the latter to overwrite the former
- Expose feature_flags for both server and client to use
- Add a utility method for checking whether a feature flag is on on server side
This commit is contained in:
Christine Chambers
2019-01-29 20:23:13 -08:00
parent 817783f466
commit b70a9ae524
6 changed files with 50 additions and 5 deletions

View File

@@ -39,6 +39,7 @@ from superset.utils.core import (
zlib_compress,
zlib_decompress_to_string,
)
from superset.utils.feature_flags import is_feature_enabled
def mock_parse_human_datetime(s):
@@ -756,3 +757,11 @@ class UtilsTestCase(unittest.TestCase):
}
convert_legacy_filters_into_adhoc(form_data)
self.assertEquals(form_data, expected)
@patch.dict('superset.feature_flags', {'FOO': True}, clear=True)
def test_existing_feature_flags(self):
self.assertTrue(is_feature_enabled('FOO'))
@patch.dict('superset.feature_flags', {}, clear=True)
def test_nonexistent_feature_flags(self):
self.assertFalse(is_feature_enabled('FOO'))