6
6
from aws_lambda_powertools .utilities .feature_flags import ConfigurationError , schema
7
7
from aws_lambda_powertools .utilities .feature_flags .appconfig import AppConfigStore
8
8
from aws_lambda_powertools .utilities .feature_flags .feature_flags import FeatureFlags
9
- from aws_lambda_powertools .utilities .feature_flags .schema import ACTION
9
+ from aws_lambda_powertools .utilities .feature_flags .schema import RuleAction
10
10
from aws_lambda_powertools .utilities .parameters import GetParameterError
11
11
12
12
@@ -56,7 +56,7 @@ def test_toggles_rule_does_not_match(mocker, config):
56
56
"value_when_applies" : False ,
57
57
"conditions" : [
58
58
{
59
- "action" : ACTION .EQUALS .value ,
59
+ "action" : RuleAction .EQUALS .value ,
60
60
"key" : "tenant_id" ,
61
61
"value" : "345345435" ,
62
62
}
@@ -106,7 +106,7 @@ def test_toggles_conditions_no_match(mocker, config):
106
106
"value_when_applies" : False ,
107
107
"conditions" : [
108
108
{
109
- "action" : ACTION .EQUALS .value ,
109
+ "action" : RuleAction .EQUALS .value ,
110
110
"key" : "tenant_id" ,
111
111
"value" : "345345435" ,
112
112
}
@@ -136,12 +136,12 @@ def test_toggles_conditions_rule_match_equal_multiple_conditions(mocker, config)
136
136
"value_when_applies" : expected_value ,
137
137
"conditions" : [
138
138
{
139
- "action" : ACTION .EQUALS .value , # this rule will match, it has multiple conditions
139
+ "action" : RuleAction .EQUALS .value , # this rule will match, it has multiple conditions
140
140
"key" : "tenant_id" ,
141
141
"value" : tenant_id_val ,
142
142
},
143
143
{
144
- "action" : ACTION .EQUALS .value ,
144
+ "action" : RuleAction .EQUALS .value ,
145
145
"key" : "username" ,
146
146
"value" : username_val ,
147
147
},
@@ -178,12 +178,12 @@ def test_toggles_conditions_no_rule_match_equal_multiple_conditions(mocker, conf
178
178
"value_when_applies" : False ,
179
179
"conditions" : [
180
180
{
181
- "action" : ACTION .EQUALS .value ,
181
+ "action" : RuleAction .EQUALS .value ,
182
182
"key" : "tenant_id" ,
183
183
"value" : "645654" ,
184
184
},
185
185
{
186
- "action" : ACTION .EQUALS .value ,
186
+ "action" : RuleAction .EQUALS .value ,
187
187
"key" : "username" ,
188
188
"value" : "a" ,
189
189
},
@@ -214,12 +214,12 @@ def test_toggles_conditions_rule_match_multiple_actions_multiple_rules_multiple_
214
214
"value_when_applies" : expected_value_first_check ,
215
215
"conditions" : [
216
216
{
217
- "action" : ACTION .EQUALS .value ,
217
+ "action" : RuleAction .EQUALS .value ,
218
218
"key" : "tenant_id" ,
219
219
"value" : "6" ,
220
220
},
221
221
{
222
- "action" : ACTION .STARTSWITH .value ,
222
+ "action" : RuleAction .STARTSWITH .value ,
223
223
"key" : "username" ,
224
224
"value" : "a" ,
225
225
},
@@ -230,17 +230,17 @@ def test_toggles_conditions_rule_match_multiple_actions_multiple_rules_multiple_
230
230
"value_when_applies" : expected_value_second_check ,
231
231
"conditions" : [
232
232
{
233
- "action" : ACTION .EQUALS .value ,
233
+ "action" : RuleAction .EQUALS .value ,
234
234
"key" : "tenant_id" ,
235
235
"value" : "4446" ,
236
236
},
237
237
{
238
- "action" : ACTION .STARTSWITH .value ,
238
+ "action" : RuleAction .STARTSWITH .value ,
239
239
"key" : "username" ,
240
240
"value" : "a" ,
241
241
},
242
242
{
243
- "action" : ACTION .ENDSWITH .value ,
243
+ "action" : RuleAction .ENDSWITH .value ,
244
244
"key" : "username" ,
245
245
"value" : "z" ,
246
246
},
@@ -283,7 +283,7 @@ def test_toggles_match_rule_with_contains_action(mocker, config):
283
283
"value_when_applies" : expected_value ,
284
284
"conditions" : [
285
285
{
286
- "action" : ACTION .CONTAINS .value ,
286
+ "action" : RuleAction .CONTAINS .value ,
287
287
"key" : "tenant_id" ,
288
288
"value" : ["6" , "2" ],
289
289
}
@@ -310,7 +310,7 @@ def test_toggles_no_match_rule_with_contains_action(mocker, config):
310
310
"value_when_applies" : True ,
311
311
"conditions" : [
312
312
{
313
- "action" : ACTION .CONTAINS .value ,
313
+ "action" : RuleAction .CONTAINS .value ,
314
314
"key" : "tenant_id" ,
315
315
"value" : ["8" , "2" ],
316
316
}
@@ -337,7 +337,7 @@ def test_multiple_features_enabled(mocker, config):
337
337
"value_when_applies" : True ,
338
338
"conditions" : [
339
339
{
340
- "action" : ACTION .CONTAINS .value ,
340
+ "action" : RuleAction .CONTAINS .value ,
341
341
"key" : "tenant_id" ,
342
342
"value" : ["6" , "2" ],
343
343
}
@@ -370,7 +370,7 @@ def test_multiple_features_only_some_enabled(mocker, config):
370
370
"value_when_applies" : True ,
371
371
"conditions" : [
372
372
{
373
- "action" : ACTION .CONTAINS .value ,
373
+ "action" : RuleAction .CONTAINS .value ,
374
374
"key" : "tenant_id" ,
375
375
"value" : ["6" , "2" ],
376
376
}
@@ -392,7 +392,7 @@ def test_multiple_features_only_some_enabled(mocker, config):
392
392
"value_when_applies" : False ,
393
393
"conditions" : [
394
394
{
395
- "action" : ACTION .EQUALS .value ,
395
+ "action" : RuleAction .EQUALS .value ,
396
396
"key" : "tenant_id" ,
397
397
"value" : "7" ,
398
398
}
@@ -456,7 +456,7 @@ def test_match_by_action_attribute_error(mocker, config):
456
456
# GIVEN a startswith action and 2 integer
457
457
conf_store = init_configuration_store (mocker , {}, config )
458
458
# WHEN calling _match_by_action
459
- result = conf_store ._match_by_action (ACTION .STARTSWITH .value , 1 , 100 )
459
+ result = conf_store ._match_by_action (RuleAction .STARTSWITH .value , 1 , 100 )
460
460
# THEN swallow the AttributeError and return False
461
461
assert result is False
462
462
0 commit comments