@@ -397,7 +397,8 @@ def test_flags_no_match_rule_with_not_in_action(mocker, config):
397
397
feature_flags = init_feature_flags (mocker , mocked_app_config_schema , config )
398
398
toggle = feature_flags .evaluate (name = "my_feature" , context = {"tenant_id" : "6" , "username" : "a" }, default = False )
399
399
assert toggle == expected_value
400
-
400
+
401
+
401
402
def test_flags_match_rule_with_key_in_value_action (mocker , config ):
402
403
expected_value = True
403
404
mocked_app_config_schema = {
@@ -492,14 +493,15 @@ def test_flags_no_match_rule_with_key_not_in_value_action(mocker, config):
492
493
feature_flags = init_feature_flags (mocker , mocked_app_config_schema , config )
493
494
toggle = feature_flags .evaluate (name = "my_feature" , context = {"tenant_id" : "6" , "username" : "a" }, default = False )
494
495
assert toggle == expected_value
495
-
496
+
497
+
496
498
def test_flags_match_rule_with_value_in_key_action (mocker , config ):
497
499
expected_value = True
498
500
mocked_app_config_schema = {
499
501
"my_feature" : {
500
502
"default" : False ,
501
503
"rules" : {
502
- "tenant id is contained in [6, 2] " : {
504
+ "user is in the SYSADMIN group " : {
503
505
"when_match" : expected_value ,
504
506
"conditions" : [
505
507
{
@@ -513,7 +515,9 @@ def test_flags_match_rule_with_value_in_key_action(mocker, config):
513
515
}
514
516
}
515
517
feature_flags = init_feature_flags (mocker , mocked_app_config_schema , config )
516
- toggle = feature_flags .evaluate (name = "my_feature" , context = {"tenant_id" : "6" , "username" : "a" , "groups" : ["SYSADMIN" , "IT" ]}, default = False )
518
+ toggle = feature_flags .evaluate (
519
+ name = "my_feature" , context = {"tenant_id" : "6" , "username" : "a" , "groups" : ["SYSADMIN" , "IT" ]}, default = False
520
+ )
517
521
assert toggle == expected_value
518
522
519
523
@@ -537,7 +541,9 @@ def test_flags_no_match_rule_with_value_in_key_action(mocker, config):
537
541
}
538
542
}
539
543
feature_flags = init_feature_flags (mocker , mocked_app_config_schema , config )
540
- toggle = feature_flags .evaluate (name = "my_feature" , context = {"tenant_id" : "6" , "username" : "a" , "groups" : ["SYSADMIN" , "IT" ]}, default = False )
544
+ toggle = feature_flags .evaluate (
545
+ name = "my_feature" , context = {"tenant_id" : "6" , "username" : "a" , "groups" : ["SYSADMIN" , "IT" ]}, default = False
546
+ )
541
547
assert toggle == expected_value
542
548
543
549
@@ -547,7 +553,7 @@ def test_flags_match_rule_with_value_not_in_key_action(mocker, config):
547
553
"my_feature" : {
548
554
"default" : False ,
549
555
"rules" : {
550
- "tenant id is contained in [8, 2] " : {
556
+ "user is in the GUEST group " : {
551
557
"when_match" : expected_value ,
552
558
"conditions" : [
553
559
{
@@ -561,7 +567,9 @@ def test_flags_match_rule_with_value_not_in_key_action(mocker, config):
561
567
}
562
568
}
563
569
feature_flags = init_feature_flags (mocker , mocked_app_config_schema , config )
564
- toggle = feature_flags .evaluate (name = "my_feature" , context = {"tenant_id" : "6" , "username" : "a" , "groups" : ["SYSADMIN" , "IT" ]}, default = False )
570
+ toggle = feature_flags .evaluate (
571
+ name = "my_feature" , context = {"tenant_id" : "6" , "username" : "a" , "groups" : ["SYSADMIN" , "IT" ]}, default = False
572
+ )
565
573
assert toggle == expected_value
566
574
567
575
@@ -571,7 +579,7 @@ def test_flags_no_match_rule_with_value_not_in_key_action(mocker, config):
571
579
"my_feature" : {
572
580
"default" : expected_value ,
573
581
"rules" : {
574
- "tenant id is contained in [8, 2] " : {
582
+ "user is in the SYSADMIN group " : {
575
583
"when_match" : True ,
576
584
"conditions" : [
577
585
{
@@ -585,12 +593,12 @@ def test_flags_no_match_rule_with_value_not_in_key_action(mocker, config):
585
593
}
586
594
}
587
595
feature_flags = init_feature_flags (mocker , mocked_app_config_schema , config )
588
- toggle = feature_flags .evaluate (name = "my_feature" , context = {"tenant_id" : "6" , "username" : "a" , "groups" : ["SYSADMIN" , "IT" ]}, default = False )
596
+ toggle = feature_flags .evaluate (
597
+ name = "my_feature" , context = {"tenant_id" : "6" , "username" : "a" , "groups" : ["SYSADMIN" , "IT" ]}, default = False
598
+ )
589
599
assert toggle == expected_value
590
600
591
601
592
-
593
-
594
602
# Check multiple features
595
603
def test_multiple_features_enabled (mocker , config ):
596
604
expected_value = ["my_feature" , "my_feature2" ]
0 commit comments