|
15 | 15 | from splitio.models.events import Event, EventWrapper |
16 | 16 | from splitio.models.telemetry import MethodExceptions, MethodLatencies, TelemetryConfig, MethodExceptionsAndLatencies |
17 | 17 | from splitio.storage import FlagSetsFilter |
18 | | -from tests.integration import splits_json |
19 | | - |
20 | 18 |
|
21 | 19 | class RedisSplitStorageTests(object): |
22 | 20 | """Redis split storage test cases.""" |
@@ -189,52 +187,6 @@ def test_flag_sets(self, mocker): |
189 | 187 | storage2 = RedisSplitStorage(adapter, True, 1, ['set2', 'set3']) |
190 | 188 | assert storage2.flag_set_filter.flag_sets == set({'set2', 'set3'}) |
191 | 189 |
|
192 | | - def test_fetching_split_with_flag_set(self, mocker): |
193 | | - """Test retrieving a split works.""" |
194 | | - adapter = mocker.Mock(spec=RedisAdapter) |
195 | | - adapter.get.return_value = json.dumps(splits_json["splitChange1_1"]["splits"][0]) |
196 | | - adapter.keys.return_value = ['SPLIT_1', 'SPLIT_2'] |
197 | | - |
198 | | - def mget(keys): |
199 | | - if keys == ['SPLIT_2']: |
200 | | - return [json.dumps(splits_json["splitChange1_1"]["splits"][0])] |
201 | | - if keys == ['SPLIT_2', 'SPLIT_1']: |
202 | | - return [json.dumps(splits_json["splitChange1_1"]["splits"][0]), json.dumps(splits_json["splitChange1_1"]["splits"][1])] |
203 | | - adapter.mget = mget |
204 | | - |
205 | | - storage = RedisSplitStorage(adapter, config_flag_sets=['set_1']) |
206 | | - |
207 | | - def get_feature_flags_by_sets(flag_sets): |
208 | | - if flag_sets=={'set_1'}: |
209 | | - return [] |
210 | | - if flag_sets=={'set2'}: |
211 | | - return ['SPLIT_2'] |
212 | | - if flag_sets=={'set2', 'set1'}: |
213 | | - return ['SPLIT_2', 'SPLIT_1'] |
214 | | - storage.get_feature_flags_by_sets = get_feature_flags_by_sets |
215 | | - |
216 | | - assert storage.get('SPLIT_2') == None |
217 | | - assert storage.get_split_names() == [] |
218 | | - assert storage.get_all_splits() == [] |
219 | | - |
220 | | - storage = RedisSplitStorage(adapter, config_flag_sets=['set2']) |
221 | | - storage.get_feature_flags_by_sets = get_feature_flags_by_sets |
222 | | - assert storage.get('SPLIT_2').name == 'SPLIT_2' |
223 | | - assert storage.get_split_names() == ['SPLIT_2'] |
224 | | - splits = storage.get_all_splits() |
225 | | - assert splits[0].name == 'SPLIT_2' |
226 | | - assert len(splits) == 1 |
227 | | - |
228 | | - storage = RedisSplitStorage(adapter, config_flag_sets=['set2', 'set1']) |
229 | | - storage.get_feature_flags_by_sets = get_feature_flags_by_sets |
230 | | - assert storage.get('SPLIT_2').name == 'SPLIT_2' |
231 | | - assert storage.get_split_names() == ['SPLIT_2', 'SPLIT_1'] |
232 | | - splits = storage.get_all_splits() |
233 | | - assert splits[0].name == 'SPLIT_2' |
234 | | - assert splits[1].name == 'SPLIT_1' |
235 | | - assert len(splits) == 2 |
236 | | - |
237 | | - |
238 | 190 | class RedisSegmentStorageTests(object): |
239 | 191 | """Redis segment storage test cases.""" |
240 | 192 |
|
|
0 commit comments