Skip to content

Commit

Permalink
refactor: get_all_enabled_feature_toggles to get_enabled_features
Browse files Browse the repository at this point in the history
  • Loading branch information
heitorlessa committed Jul 30, 2021
1 parent 38c7bd1 commit f025789
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions tests/functional/feature_toggles/test_feature_toggles.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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


Expand All @@ -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 == []
Expand Down

0 comments on commit f025789

Please sign in to comment.