Skip to content

Commit

Permalink
addressing PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
pawels-optimizely committed Apr 23, 2020
1 parent 540e2f5 commit 702ff3f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion optimizely/helpers/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class DecisionNotificationTypes(object):
FEATURE = 'feature'
FEATURE_TEST = 'feature-test'
FEATURE_VARIABLE = 'feature-variable'
FEATURE_VARIABLES = 'feature-variables'
ALL_FEATURE_VARIABLES = 'all-feature-variables'


class DecisionSources(object):
Expand Down
8 changes: 4 additions & 4 deletions optimizely/optimizely.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ def _get_all_feature_variables_for_type(

self.notification_center.send_notifications(
enums.NotificationTypes.DECISION,
enums.DecisionNotificationTypes.FEATURE_VARIABLES,
enums.DecisionNotificationTypes.ALL_FEATURE_VARIABLES,
user_id,
attributes or {},
{
Expand Down Expand Up @@ -764,7 +764,7 @@ def get_feature_variable_string(self, feature_key, variable_key, user_id, attrib
)

def get_feature_variable_json(self, feature_key, variable_key, user_id, attributes=None):
""" Returns value for a certain json variable attached to a feature.
""" Returns value for a certain JSON variable attached to a feature.
Args:
feature_key: Key of the feature whose variable's value is being accessed.
Expand All @@ -790,15 +790,15 @@ def get_feature_variable_json(self, feature_key, variable_key, user_id, attribut
)

def get_all_feature_variables(self, feature_key, user_id, attributes=None):
""" Returns dictionary of all variables attached to a feature.
""" Returns dictionary of all variables and their corresponding values in the context of a feature.
Args:
feature_key: Key of the feature whose variable's value is being accessed.
user_id: ID for user.
attributes: Dict representing user attributes.
Returns:
Dictionary object of the variable. None if:
Dictionary mapping variable key to variable value. None if:
- Feature key is invalid.
"""

Expand Down
12 changes: 6 additions & 6 deletions tests/test_optimizely.py
Original file line number Diff line number Diff line change
Expand Up @@ -2599,7 +2599,7 @@ def test_get_all_feature_variables(self):

mock_broadcast_decision.assert_called_once_with(
enums.NotificationTypes.DECISION,
'feature-variables',
'all-feature-variables',
'test_user',
{},
{
Expand Down Expand Up @@ -3006,7 +3006,7 @@ def test_get_all_feature_variables_for_feature_in_rollout(self):
)
mock_broadcast_decision.assert_called_once_with(
enums.NotificationTypes.DECISION,
'feature-variables',
'all-feature-variables',
'test_user',
{'test_attribute': 'test_value'},
{
Expand Down Expand Up @@ -3253,7 +3253,7 @@ def test_get_feature_variable__returns_default_value_if_variable_usage_not_in_va
)
mock_config_logger.info.reset_mock()

# json
# JSON
with mock.patch(
'optimizely.decision_service.DecisionService.get_variation_for_feature',
return_value=decision_service.Decision(mock_experiment, mock_variation, enums.DecisionSources.FEATURE_TEST),
Expand Down Expand Up @@ -3460,7 +3460,7 @@ def test_get_feature_variable__returns_default_value_if_no_variation(self):

mock_client_logger.info.reset_mock()

# json
# JSON
with mock.patch(
'optimizely.decision_service.DecisionService.get_variation_for_feature',
return_value=decision_service.Decision(None, None, enums.DecisionSources.ROLLOUT),
Expand Down Expand Up @@ -3961,7 +3961,7 @@ def test_get_feature_variable__returns_default_value_if_feature_not_enabled(self
'Returning the default variable value "devel".'
)

# json
# JSON
with mock.patch(
'optimizely.decision_service.DecisionService.get_variation_for_feature',
return_value=decision_service.Decision(mock_experiment, mock_variation, enums.DecisionSources.FEATURE_TEST),
Expand Down Expand Up @@ -4087,7 +4087,7 @@ def test_get_feature_variable__returns_default_value_if_feature_not_enabled_in_r
'Returning the default variable value "Hello".'
)

# json
# JSON
with mock.patch(
'optimizely.decision_service.DecisionService.get_variation_for_feature',
return_value=decision_service.Decision(mock_experiment, mock_variation, enums.DecisionSources.ROLLOUT),
Expand Down

0 comments on commit 702ff3f

Please sign in to comment.