Skip to content

Commit

Permalink
chore: overdue linting
Browse files Browse the repository at this point in the history
Signed-off-by: heitorlessa <[email protected]>
  • Loading branch information
heitorlessa committed Oct 5, 2021
1 parent 0d46d39 commit 348aee2
Showing 1 changed file with 77 additions and 17 deletions.
94 changes: 77 additions & 17 deletions tests/functional/feature_flags/test_feature_flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,8 @@ def test_get_configuration_with_envelope_and_raw(mocker, config):

assert "log_level" in config
assert "log_level" not in features_config



##
## Inequality test cases
##
Expand All @@ -828,9 +829,12 @@ def test_flags_not_equal_no_match(mocker, config):
}
}
feature_flags = init_feature_flags(mocker, mocked_app_config_schema, config)
toggle = feature_flags.evaluate(name="my_feature", context={"tenant_id": "345345435", "username": "a"}, default=False)
toggle = feature_flags.evaluate(
name="my_feature", context={"tenant_id": "345345435", "username": "a"}, default=False
)
assert toggle == expected_value


def test_flags_not_equal_match(mocker, config):
expected_value = True
mocked_app_config_schema = {
Expand Down Expand Up @@ -876,9 +880,14 @@ def test_flags_less_than_no_match_1(mocker, config):
}
}
feature_flags = init_feature_flags(mocker, mocked_app_config_schema, config)
toggle = feature_flags.evaluate(name="my_feature", context={"tenant_id": "345345435", "username": "a", "current_date": "2021.12.25"}, default=False)
toggle = feature_flags.evaluate(
name="my_feature",
context={"tenant_id": "345345435", "username": "a", "current_date": "2021.12.25"},
default=False,
)
assert toggle == expected_value


def test_flags_less_than_no_match_2(mocker, config):
expected_value = False
mocked_app_config_schema = {
Expand All @@ -899,9 +908,14 @@ def test_flags_less_than_no_match_2(mocker, config):
}
}
feature_flags = init_feature_flags(mocker, mocked_app_config_schema, config)
toggle = feature_flags.evaluate(name="my_feature", context={"tenant_id": "345345435", "username": "a", "current_date": "2021.10.31"}, default=False)
toggle = feature_flags.evaluate(
name="my_feature",
context={"tenant_id": "345345435", "username": "a", "current_date": "2021.10.31"},
default=False,
)
assert toggle == expected_value


def test_flags_less_than_match(mocker, config):
expected_value = True
mocked_app_config_schema = {
Expand All @@ -922,10 +936,15 @@ def test_flags_less_than_match(mocker, config):
}
}
feature_flags = init_feature_flags(mocker, mocked_app_config_schema, config)
toggle = feature_flags.evaluate(name="my_feature", context={"tenant_id": "345345435", "username": "a", "current_date": "2021.04.01"}, default=False)
toggle = feature_flags.evaluate(
name="my_feature",
context={"tenant_id": "345345435", "username": "a", "current_date": "2021.04.01"},
default=False,
)
assert toggle == expected_value

# Test less than or equal to

# Test less than or equal to
def test_flags_less_than_or_equal_no_match(mocker, config):
expected_value = False
mocked_app_config_schema = {
Expand All @@ -946,9 +965,14 @@ def test_flags_less_than_or_equal_no_match(mocker, config):
}
}
feature_flags = init_feature_flags(mocker, mocked_app_config_schema, config)
toggle = feature_flags.evaluate(name="my_feature", context={"tenant_id": "345345435", "username": "a", "current_date": "2021.12.25"}, default=False)
toggle = feature_flags.evaluate(
name="my_feature",
context={"tenant_id": "345345435", "username": "a", "current_date": "2021.12.25"},
default=False,
)
assert toggle == expected_value


def test_flags_less_than_or_equal_match_1(mocker, config):
expected_value = True
mocked_app_config_schema = {
Expand All @@ -969,7 +993,11 @@ def test_flags_less_than_or_equal_match_1(mocker, config):
}
}
feature_flags = init_feature_flags(mocker, mocked_app_config_schema, config)
toggle = feature_flags.evaluate(name="my_feature", context={"tenant_id": "345345435", "username": "a", "current_date": "2021.04.01"}, default=False)
toggle = feature_flags.evaluate(
name="my_feature",
context={"tenant_id": "345345435", "username": "a", "current_date": "2021.04.01"},
default=False,
)
assert toggle == expected_value


Expand All @@ -993,9 +1021,14 @@ def test_flags_less_than_or_equal_match_2(mocker, config):
}
}
feature_flags = init_feature_flags(mocker, mocked_app_config_schema, config)
toggle = feature_flags.evaluate(name="my_feature", context={"tenant_id": "345345435", "username": "a", "current_date": "2021.10.31"}, default=False)
toggle = feature_flags.evaluate(
name="my_feature",
context={"tenant_id": "345345435", "username": "a", "current_date": "2021.10.31"},
default=False,
)
assert toggle == expected_value


# Test greater than
def test_flags_greater_than_no_match_1(mocker, config):
expected_value = False
Expand All @@ -1017,9 +1050,14 @@ def test_flags_greater_than_no_match_1(mocker, config):
}
}
feature_flags = init_feature_flags(mocker, mocked_app_config_schema, config)
toggle = feature_flags.evaluate(name="my_feature", context={"tenant_id": "345345435", "username": "a", "current_date": "2021.04.01"}, default=False)
toggle = feature_flags.evaluate(
name="my_feature",
context={"tenant_id": "345345435", "username": "a", "current_date": "2021.04.01"},
default=False,
)
assert toggle == expected_value


def test_flags_greater_than_no_match_2(mocker, config):
expected_value = False
mocked_app_config_schema = {
Expand All @@ -1040,9 +1078,14 @@ def test_flags_greater_than_no_match_2(mocker, config):
}
}
feature_flags = init_feature_flags(mocker, mocked_app_config_schema, config)
toggle = feature_flags.evaluate(name="my_feature", context={"tenant_id": "345345435", "username": "a", "current_date": "2021.10.31"}, default=False)
toggle = feature_flags.evaluate(
name="my_feature",
context={"tenant_id": "345345435", "username": "a", "current_date": "2021.10.31"},
default=False,
)
assert toggle == expected_value


def test_flags_greater_than_match(mocker, config):
expected_value = True
mocked_app_config_schema = {
Expand All @@ -1063,10 +1106,15 @@ def test_flags_greater_than_match(mocker, config):
}
}
feature_flags = init_feature_flags(mocker, mocked_app_config_schema, config)
toggle = feature_flags.evaluate(name="my_feature", context={"tenant_id": "345345435", "username": "a", "current_date": "2021.12.25"}, default=False)
toggle = feature_flags.evaluate(
name="my_feature",
context={"tenant_id": "345345435", "username": "a", "current_date": "2021.12.25"},
default=False,
)
assert toggle == expected_value

# Test greater than or equal to

# Test greater than or equal to
def test_flags_greater_than_or_equal_no_match(mocker, config):
expected_value = False
mocked_app_config_schema = {
Expand All @@ -1087,9 +1135,14 @@ def test_flags_greater_than_or_equal_no_match(mocker, config):
}
}
feature_flags = init_feature_flags(mocker, mocked_app_config_schema, config)
toggle = feature_flags.evaluate(name="my_feature", context={"tenant_id": "345345435", "username": "a", "current_date": "2021.04.01"}, default=False)
toggle = feature_flags.evaluate(
name="my_feature",
context={"tenant_id": "345345435", "username": "a", "current_date": "2021.04.01"},
default=False,
)
assert toggle == expected_value


def test_flags_greater_than_or_equal_match_1(mocker, config):
expected_value = True
mocked_app_config_schema = {
Expand All @@ -1110,7 +1163,11 @@ def test_flags_greater_than_or_equal_match_1(mocker, config):
}
}
feature_flags = init_feature_flags(mocker, mocked_app_config_schema, config)
toggle = feature_flags.evaluate(name="my_feature", context={"tenant_id": "345345435", "username": "a", "current_date": "2021.12.25"}, default=False)
toggle = feature_flags.evaluate(
name="my_feature",
context={"tenant_id": "345345435", "username": "a", "current_date": "2021.12.25"},
default=False,
)
assert toggle == expected_value


Expand All @@ -1134,6 +1191,9 @@ def test_flags_greater_than_or_equal_match_2(mocker, config):
}
}
feature_flags = init_feature_flags(mocker, mocked_app_config_schema, config)
toggle = feature_flags.evaluate(name="my_feature", context={"tenant_id": "345345435", "username": "a", "current_date": "2021.10.31"}, default=False)
toggle = feature_flags.evaluate(
name="my_feature",
context={"tenant_id": "345345435", "username": "a", "current_date": "2021.10.31"},
default=False,
)
assert toggle == expected_value

0 comments on commit 348aee2

Please sign in to comment.