Skip to content

Commit 46640d8

Browse files
committed
Fix tests
1 parent 813d20c commit 46640d8

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

optimizely/decision_service.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -714,8 +714,8 @@ def get_decision_for_flag(
714714
reasons.extend(holdout_decision['reasons'])
715715

716716
decision = holdout_decision['decision']
717-
# Check if user was bucketed into holdout (has a decision)
718-
if decision is None:
717+
# Check if user was bucketed into holdout (has a variation)
718+
if decision is None or decision.variation is None:
719719
continue
720720

721721
message = (
@@ -905,9 +905,9 @@ def get_variation_for_holdout(
905905
self.logger.info(message)
906906
decide_reasons.append(message)
907907

908-
# Create Decision for holdout - experiment is None, source is HOLDOUT
908+
# Create Decision for holdout - pass holdout dict as experiment, source is HOLDOUT
909909
holdout_decision: Decision = Decision(
910-
experiment=None,
910+
experiment=holdout,
911911
variation=variation,
912912
source=enums.DecisionSources.HOLDOUT,
913913
cmab_uuid=None

tests/test_user_context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,7 @@ def test_decide__option__include_reasons__feature_rollout(self):
873873
'Audiences for rule 1 collectively evaluated to TRUE.',
874874
'User "test_user" meets audience conditions for targeting rule 1.',
875875
'User "test_user" bucketed into a targeting rule 1.',
876-
'The user "test_user" is bucketed into a rollout for feature flag "test_feature_in_rollout".'
876+
"The user 'test_user' is bucketed into a rollout for feature flag 'test_feature_in_rollout'."
877877
]
878878

879879
self.assertEqual(expected_reasons, actual.reasons)

0 commit comments

Comments
 (0)