Skip to content

Commit 4c559eb

Browse files
committed
fix: feat flag description for new rule actions
1 parent a17060e commit 4c559eb

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

tests/functional/feature_flags/test_feature_flags.py

+19-11
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,8 @@ def test_flags_no_match_rule_with_not_in_action(mocker, config):
397397
feature_flags = init_feature_flags(mocker, mocked_app_config_schema, config)
398398
toggle = feature_flags.evaluate(name="my_feature", context={"tenant_id": "6", "username": "a"}, default=False)
399399
assert toggle == expected_value
400-
400+
401+
401402
def test_flags_match_rule_with_key_in_value_action(mocker, config):
402403
expected_value = True
403404
mocked_app_config_schema = {
@@ -492,14 +493,15 @@ def test_flags_no_match_rule_with_key_not_in_value_action(mocker, config):
492493
feature_flags = init_feature_flags(mocker, mocked_app_config_schema, config)
493494
toggle = feature_flags.evaluate(name="my_feature", context={"tenant_id": "6", "username": "a"}, default=False)
494495
assert toggle == expected_value
495-
496+
497+
496498
def test_flags_match_rule_with_value_in_key_action(mocker, config):
497499
expected_value = True
498500
mocked_app_config_schema = {
499501
"my_feature": {
500502
"default": False,
501503
"rules": {
502-
"tenant id is contained in [6, 2]": {
504+
"user is in the SYSADMIN group": {
503505
"when_match": expected_value,
504506
"conditions": [
505507
{
@@ -513,7 +515,9 @@ def test_flags_match_rule_with_value_in_key_action(mocker, config):
513515
}
514516
}
515517
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+
)
517521
assert toggle == expected_value
518522

519523

@@ -537,7 +541,9 @@ def test_flags_no_match_rule_with_value_in_key_action(mocker, config):
537541
}
538542
}
539543
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+
)
541547
assert toggle == expected_value
542548

543549

@@ -547,7 +553,7 @@ def test_flags_match_rule_with_value_not_in_key_action(mocker, config):
547553
"my_feature": {
548554
"default": False,
549555
"rules": {
550-
"tenant id is contained in [8, 2]": {
556+
"user is in the GUEST group": {
551557
"when_match": expected_value,
552558
"conditions": [
553559
{
@@ -561,7 +567,9 @@ def test_flags_match_rule_with_value_not_in_key_action(mocker, config):
561567
}
562568
}
563569
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+
)
565573
assert toggle == expected_value
566574

567575

@@ -571,7 +579,7 @@ def test_flags_no_match_rule_with_value_not_in_key_action(mocker, config):
571579
"my_feature": {
572580
"default": expected_value,
573581
"rules": {
574-
"tenant id is contained in [8, 2]": {
582+
"user is in the SYSADMIN group": {
575583
"when_match": True,
576584
"conditions": [
577585
{
@@ -585,12 +593,12 @@ def test_flags_no_match_rule_with_value_not_in_key_action(mocker, config):
585593
}
586594
}
587595
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+
)
589599
assert toggle == expected_value
590600

591601

592-
593-
594602
# Check multiple features
595603
def test_multiple_features_enabled(mocker, config):
596604
expected_value = ["my_feature", "my_feature2"]

0 commit comments

Comments
 (0)