zhaoyongjie commented on code in PR #23712:
URL: https://github.com/apache/superset/pull/23712#discussion_r1204804205
##########
tests/unit_tests/conftest.py:
##########
@@ -163,3 +164,38 @@ def dummy_query_object(request, app_context):
_datasource_dao=unittest.mock.Mock(),
session_maker=unittest.mock.Mock(),
).create(parent_result_type=result_type, **query_object)
+
+
+def with_feature_flags(**mock_feature_flags):
+ """
+ Use this decorator to mock feature flags in tests.integration_tests.
+
+ Usage:
+
+ class TestYourFeature(SupersetTestCase):
+
+ @with_feature_flags(YOUR_FEATURE=True)
+ def test_your_feature_enabled(self):
+ self.assertEqual(is_feature_enabled("YOUR_FEATURE"), True)
+
+ @with_feature_flags(YOUR_FEATURE=False)
+ def test_your_feature_disabled(self):
+ self.assertEqual(is_feature_enabled("YOUR_FEATURE"), False)
+ """
+
Review Comment:
The decorator just mocked a single FF item, in order to support more than 1
FF item, I suggest to provide a DICT structure as a parameter.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]