@@ -1852,7 +1852,7 @@ def test_get_variation(self):
18521852 'optimizely.decision_service.DecisionService.get_variation' ,
18531853 return_value = variation_result ,
18541854 ), mock .patch ('optimizely.notification_center.NotificationCenter.send_notifications' ) as mock_broadcast :
1855- variation = self .optimizely .get_variation ('test_experiment' , 'test_user' )
1855+ variation = self .optimizely .get_variation ('test_experiment' , 'test_user' )[ 'variation' ]. key
18561856 self .assertEqual (
18571857 'variation' , variation ,
18581858 )
@@ -1885,7 +1885,7 @@ def test_get_variation_lookup_and_save_is_called(self):
18851885 ) as mock_load_user_profile , mock .patch (
18861886 'optimizely.user_profile.UserProfileTracker.save_user_profile'
18871887 ) as mock_save_user_profile :
1888- variation = self .optimizely .get_variation ('test_experiment' , 'test_user' )
1888+ variation = self .optimizely .get_variation ('test_experiment' , 'test_user' )[ 'variation' ]. key
18891889 self .assertEqual (
18901890 'variation' , variation ,
18911891 )
@@ -1917,7 +1917,7 @@ def test_get_variation_with_experiment_in_feature(self):
19171917 'optimizely.decision_service.DecisionService.get_variation' ,
19181918 return_value = variation_result ,
19191919 ), mock .patch ('optimizely.notification_center.NotificationCenter.send_notifications' ) as mock_broadcast :
1920- variation = opt_obj .get_variation ('test_experiment' , 'test_user' )
1920+ variation = opt_obj .get_variation ('test_experiment' , 'test_user' )[ 'variation' ]. key
19211921 self .assertEqual ('variation' , variation )
19221922
19231923 self .assertEqual (mock_broadcast .call_count , 1 )
@@ -1946,7 +1946,7 @@ def test_get_variation__returns_none(self):
19461946 None ,
19471947 self .optimizely .get_variation (
19481948 'test_experiment' , 'test_user' , attributes = {'test_attribute' : 'test_value' },
1949- ),
1949+ )[ 'variation' ] ,
19501950 )
19511951
19521952 self .assertEqual (mock_broadcast .call_count , 1 )
@@ -5172,7 +5172,7 @@ def test_get_variation__forced_bucketing(self):
51725172 )
51735173 variation_key = self .optimizely .get_variation (
51745174 'test_experiment' , 'test_user' , attributes = {'test_attribute' : 'test_value' }
5175- )
5175+ )[ 'variation' ]. key
51765176 self .assertEqual ('variation' , variation_key )
51775177
51785178 def test_get_variation__experiment_not_running__forced_bucketing (self ):
@@ -5187,7 +5187,7 @@ def test_get_variation__experiment_not_running__forced_bucketing(self):
51875187 )
51885188 variation_key = self .optimizely .get_variation (
51895189 'test_experiment' , 'test_user' , attributes = {'test_attribute' : 'test_value' },
5190- )
5190+ )[ 'variation' ]
51915191 self .assertIsNone (variation_key )
51925192 mock_is_experiment_running .assert_called_once_with (
51935193 self .project_config .get_experiment_from_key ('test_experiment' )
@@ -5201,7 +5201,7 @@ def test_get_variation__whitelisted_user_forced_bucketing(self):
52015201 self .assertEqual ('group_exp_1_variation' , forced_variation )
52025202 variation_key = self .optimizely .get_variation (
52035203 'group_exp_1' , 'user_1' , attributes = {'test_attribute' : 'test_value' }
5204- )
5204+ )[ 'variation' ]. key
52055205 self .assertEqual ('group_exp_1_variation' , variation_key )
52065206
52075207 def test_get_variation__user_profile__forced_bucketing (self ):
@@ -5216,7 +5216,7 @@ def test_get_variation__user_profile__forced_bucketing(self):
52165216 )
52175217 variation_key = self .optimizely .get_variation (
52185218 'test_experiment' , 'test_user' , attributes = {'test_attribute' : 'test_value' },
5219- )
5219+ )[ 'variation' ]. key
52205220 self .assertEqual ('variation' , variation_key )
52215221
52225222 def test_get_variation__invalid_attributes__forced_bucketing (self ):
@@ -5228,8 +5228,7 @@ def test_get_variation__invalid_attributes__forced_bucketing(self):
52285228 )
52295229 variation_key = self .optimizely .get_variation (
52305230 'test_experiment' , 'test_user' , attributes = {'test_attribute' : 'test_value_invalid' },
5231- )
5232- variation_key = variation_key
5231+ )['variation' ].key
52335232 self .assertEqual ('variation' , variation_key )
52345233
52355234 def test_set_forced_variation__invalid_object (self ):
0 commit comments