Skip to content

Commit b930e06

Browse files
Python: Remove test for CMAB experiments with IGNORE_USER_PROFILE_SERVICE option
1 parent 0044870 commit b930e06

File tree

1 file changed

+0
-56
lines changed

1 file changed

+0
-56
lines changed

tests/test_decision_service.py

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,62 +1192,6 @@ def test_get_variation_standard_experiment_saves_user_profile(self):
11921192
# Verify user profile WAS updated for standard experiment
11931193
mock_update_profile.assert_called_once_with(experiment, variation)
11941194

1195-
def test_get_variation_cmab_experiment_with_ignore_ups_option(self):
1196-
"""Test that CMAB experiments with IGNORE_USER_PROFILE_SERVICE option don't attempt profile update."""
1197-
1198-
user = optimizely_user_context.OptimizelyUserContext(
1199-
optimizely_client=None,
1200-
logger=None,
1201-
user_id="test_user",
1202-
user_attributes={}
1203-
)
1204-
1205-
# Create a user profile tracker
1206-
user_profile_service = user_profile.UserProfileService()
1207-
user_profile_tracker = user_profile.UserProfileTracker(user.user_id, user_profile_service)
1208-
1209-
# Create a CMAB experiment
1210-
cmab_experiment = entities.Experiment(
1211-
'111150',
1212-
'cmab_experiment',
1213-
'Running',
1214-
'111150',
1215-
[],
1216-
{},
1217-
[entities.Variation('111151', 'variation_1')],
1218-
[{'entityId': '111151', 'endOfRange': 10000}],
1219-
cmab={'trafficAllocation': 5000}
1220-
)
1221-
1222-
with mock.patch('optimizely.helpers.experiment.is_experiment_running', return_value=True), \
1223-
mock.patch('optimizely.helpers.audience.does_user_meet_audience_conditions', return_value=[True, []]), \
1224-
mock.patch.object(self.decision_service.bucketer, 'bucket_to_entity_id',
1225-
return_value=['$', []]), \
1226-
mock.patch.object(self.decision_service, 'cmab_service') as mock_cmab_service, \
1227-
mock.patch.object(self.project_config, 'get_variation_from_id',
1228-
return_value=entities.Variation('111151', 'variation_1')), \
1229-
mock.patch.object(user_profile_tracker, 'update_user_profile') as mock_update_profile, \
1230-
mock.patch.object(self.decision_service, 'logger'):
1231-
1232-
mock_cmab_service.get_decision.return_value = (
1233-
{'variation_id': '111151', 'cmab_uuid': 'test-uuid'},
1234-
[]
1235-
)
1236-
1237-
# Call with IGNORE_USER_PROFILE_SERVICE option
1238-
variation_result = self.decision_service.get_variation(
1239-
self.project_config,
1240-
cmab_experiment,
1241-
user,
1242-
user_profile_tracker,
1243-
[],
1244-
options=['IGNORE_USER_PROFILE_SERVICE']
1245-
)
1246-
1247-
# Verify variation returned but profile not updated
1248-
self.assertIsNotNone(variation_result['variation'])
1249-
mock_update_profile.assert_not_called()
1250-
12511195

12521196
class FeatureFlagDecisionTests(base.BaseTest):
12531197
def setUp(self):

0 commit comments

Comments
 (0)