From f02578916f4fdf402d774c51a148b52b51a290f9 Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Fri, 30 Jul 2021 17:16:12 +0200 Subject: [PATCH] refactor: get_all_enabled_feature_toggles to get_enabled_features --- .../utilities/feature_toggles/feature_flags.py | 2 +- tests/functional/feature_toggles/test_feature_toggles.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/aws_lambda_powertools/utilities/feature_toggles/feature_flags.py b/aws_lambda_powertools/utilities/feature_toggles/feature_flags.py index 0fd96756855..ca03222d75a 100644 --- a/aws_lambda_powertools/utilities/feature_toggles/feature_flags.py +++ b/aws_lambda_powertools/utilities/feature_toggles/feature_flags.py @@ -166,7 +166,7 @@ def evaluate(self, *, feature_name: str, context: Optional[Dict[str, Any]] = Non rules=cast(List, rules_list), ) - def get_all_enabled_feature_toggles(self, *, context: Optional[Dict[str, Any]] = None) -> List[str]: + def get_enabled_features(self, *, context: Optional[Dict[str, Any]] = None) -> List[str]: """Get all enabled feature toggles while also taking into account rule_context (when a feature has defined rules) diff --git a/tests/functional/feature_toggles/test_feature_toggles.py b/tests/functional/feature_toggles/test_feature_toggles.py index 80152f8f9d7..5ff96b93ecb 100644 --- a/tests/functional/feature_toggles/test_feature_toggles.py +++ b/tests/functional/feature_toggles/test_feature_toggles.py @@ -360,7 +360,7 @@ def test_multiple_features_enabled(mocker, config): }, } conf_store = init_configuration_store(mocker, mocked_app_config_schema, config) - enabled_list: List[str] = conf_store.get_all_enabled_feature_toggles(context={"tenant_id": "6", "username": "a"}) + enabled_list: List[str] = conf_store.get_enabled_features(context={"tenant_id": "6", "username": "a"}) assert enabled_list == expected_value @@ -409,7 +409,7 @@ def test_multiple_features_only_some_enabled(mocker, config): }, } conf_store = init_configuration_store(mocker, mocked_app_config_schema, config) - enabled_list: List[str] = conf_store.get_all_enabled_feature_toggles(context={"tenant_id": "6", "username": "a"}) + enabled_list: List[str] = conf_store.get_enabled_features(context={"tenant_id": "6", "username": "a"}) assert enabled_list == expected_value @@ -430,8 +430,8 @@ def test_get_all_enabled_feature_toggles_handles_error(mocker, config): schema_fetcher = init_fetcher_side_effect(mocker, config, GetParameterError()) conf_store = FeatureFlags(schema_fetcher) - # WHEN calling get_all_enabled_feature_toggles - toggles = conf_store.get_all_enabled_feature_toggles(context=None) + # WHEN calling get_enabled_features + toggles = conf_store.get_enabled_features(context=None) # THEN handle the error and return an empty list assert toggles == []