@@ -913,7 +913,7 @@ def test_init__with_v4_datafile(self):
913
913
'test_feature_in_group' : entities .FeatureFlag ('91113' , 'test_feature_in_group' , ['32222' ], '' , {}, '19228' )
914
914
}
915
915
916
- expected_layer_id_map = {
916
+ expected_rollout_id_map = {
917
917
'211111' : entities .Layer ('211111' , [{
918
918
'key' : '211112' ,
919
919
'status' : 'Running' ,
@@ -970,7 +970,7 @@ def test_init__with_v4_datafile(self):
970
970
self .assertEqual (expected_variation_key_map , project_config .variation_key_map )
971
971
self .assertEqual (expected_variation_id_map , project_config .variation_id_map )
972
972
self .assertEqual (expected_feature_key_map , project_config .feature_key_map )
973
- self .assertEqual (expected_layer_id_map , project_config .layer_id_map )
973
+ self .assertEqual (expected_rollout_id_map , project_config .rollout_id_map )
974
974
self .assertEqual (expected_variation_variable_usage_map , project_config .variation_variable_usage_map )
975
975
976
976
def test_get_version (self ):
@@ -1128,27 +1128,27 @@ def test_get_group__invalid_id(self):
1128
1128
1129
1129
def test_get_feature_from_key__valid_feature_key (self ):
1130
1130
""" Test that a valid feature is returned given a valid feature key. """
1131
- optimizely_instance = optimizely .Optimizely (json .dumps (self .config_dict_with_features ))
1132
- project_config = optimizely_instance .config
1131
+ opt_obj = optimizely .Optimizely (json .dumps (self .config_dict_with_features ))
1132
+ project_config = opt_obj .config
1133
1133
1134
1134
expected_feature = entities .FeatureFlag ('91112' , 'test_feature_in_rollout' , [], '211111' , {})
1135
1135
self .assertEqual (expected_feature , project_config .get_feature_from_key ('test_feature_in_rollout' ))
1136
1136
1137
1137
def test_get_feature_from_key__invalid_feature_key (self ):
1138
1138
""" Test that None is returned given an invalid feature key. """
1139
1139
1140
- optimizely_instance = optimizely .Optimizely (json .dumps (self .config_dict_with_features ))
1141
- project_config = optimizely_instance .config
1140
+ opt_obj = optimizely .Optimizely (json .dumps (self .config_dict_with_features ))
1141
+ project_config = opt_obj .config
1142
1142
1143
1143
self .assertIsNone (project_config .get_feature_from_key ('invalid_feature_key' ))
1144
1144
1145
- def test_get_layer_from_id__valid_layer_id (self ):
1146
- """ Test that a valid layer is returned """
1145
+ def test_get_rollout_from_id__valid_rollout_id (self ):
1146
+ """ Test that a valid rollout is returned """
1147
1147
1148
- optimizely_instance = optimizely .Optimizely (json .dumps (self .config_dict_with_features ))
1149
- project_config = optimizely_instance .config
1148
+ opt_obj = optimizely .Optimizely (json .dumps (self .config_dict_with_features ))
1149
+ project_config = opt_obj .config
1150
1150
1151
- expected_layer = entities .Layer ('211111' , [{
1151
+ expected_rollout = entities .Layer ('211111' , [{
1152
1152
'id' : '211127' ,
1153
1153
'key' : '211127' ,
1154
1154
'status' : 'Running' ,
@@ -1194,12 +1194,12 @@ def test_get_layer_from_id__valid_layer_id(self):
1194
1194
'id' : '211149'
1195
1195
}]
1196
1196
}])
1197
- self .assertEqual (expected_layer , project_config .get_layer_from_id ('211111' ))
1197
+ self .assertEqual (expected_rollout , project_config .get_rollout_from_id ('211111' ))
1198
1198
1199
1199
def test_get_variable_value_for_variation__returns_valid_value (self ):
1200
1200
""" Test that the right value and type are returned. """
1201
- optimizely_instance = optimizely .Optimizely (json .dumps (self .config_dict_with_features ))
1202
- project_config = optimizely_instance .config
1201
+ opt_obj = optimizely .Optimizely (json .dumps (self .config_dict_with_features ))
1202
+ project_config = opt_obj .config
1203
1203
1204
1204
variation = project_config .get_variation_from_id ('test_experiment' , '111128' )
1205
1205
is_working_variable = project_config .get_variable_for_feature ('test_feature_in_experiment' , 'is_working' )
@@ -1210,17 +1210,17 @@ def test_get_variable_value_for_variation__returns_valid_value(self):
1210
1210
def test_get_variable_value_for_variation__invalid_variable (self ):
1211
1211
""" Test that an invalid variable key will return None. """
1212
1212
1213
- optimizely_instance = optimizely .Optimizely (json .dumps (self .config_dict_with_features ))
1214
- project_config = optimizely_instance .config
1213
+ opt_obj = optimizely .Optimizely (json .dumps (self .config_dict_with_features ))
1214
+ project_config = opt_obj .config
1215
1215
1216
1216
variation = project_config .get_variation_from_id ('test_experiment' , '111128' )
1217
1217
self .assertIsNone (project_config .get_variable_value_for_variation (None , variation ))
1218
1218
1219
1219
def test_get_variable_value_for_variation__no_variables_for_variation (self ):
1220
1220
""" Test that a variation with no variables will return None. """
1221
1221
1222
- optimizely_instance = optimizely .Optimizely (json .dumps (self .config_dict_with_features ))
1223
- project_config = optimizely_instance .config
1222
+ opt_obj = optimizely .Optimizely (json .dumps (self .config_dict_with_features ))
1223
+ project_config = opt_obj .config
1224
1224
1225
1225
variation = entities .Variation ('1111281' , 'invalid_variation' , [])
1226
1226
is_working_variable = project_config .get_variable_for_feature ('test_feature_in_experiment' , 'is_working' )
@@ -1229,25 +1229,25 @@ def test_get_variable_value_for_variation__no_variables_for_variation(self):
1229
1229
def test_get_variable_for_feature__returns_valid_variable (self ):
1230
1230
""" Test that the feature variable is returned. """
1231
1231
1232
- optimizely_instance = optimizely .Optimizely (json .dumps (self .config_dict_with_features ))
1233
- project_config = optimizely_instance .config
1232
+ opt_obj = optimizely .Optimizely (json .dumps (self .config_dict_with_features ))
1233
+ project_config = opt_obj .config
1234
1234
1235
1235
variable = project_config .get_variable_for_feature ('test_feature_in_experiment' , 'is_working' )
1236
1236
self .assertEqual (entities .Variable ('127' , 'is_working' , 'boolean' , 'true' ), variable )
1237
1237
1238
1238
def test_get_variable_for_feature__invalid_feature_key (self ):
1239
1239
""" Test that an invalid feature key will return None. """
1240
1240
1241
- optimizely_instance = optimizely .Optimizely (json .dumps (self .config_dict_with_features ))
1242
- project_config = optimizely_instance .config
1241
+ opt_obj = optimizely .Optimizely (json .dumps (self .config_dict_with_features ))
1242
+ project_config = opt_obj .config
1243
1243
1244
1244
self .assertIsNone (project_config .get_variable_for_feature ('invalid_feature' , 'is_working' ))
1245
1245
1246
1246
def test_get_variable_for_feature__invalid_variable_key (self ):
1247
1247
""" Test that an invalid variable key will return None. """
1248
1248
1249
- optimizely_instance = optimizely .Optimizely (json .dumps (self .config_dict_with_features ))
1250
- project_config = optimizely_instance .config
1249
+ opt_obj = optimizely .Optimizely (json .dumps (self .config_dict_with_features ))
1250
+ project_config = opt_obj .config
1251
1251
1252
1252
self .assertIsNone (project_config .get_variable_for_feature ('test_feature_in_experiment' , 'invalid_variable_key' ))
1253
1253
0 commit comments