Skip to content

Commit

Permalink
add false flag
Browse files Browse the repository at this point in the history
  • Loading branch information
neilkakkar committed Nov 8, 2023
1 parent 854e60e commit f290b96
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion posthog/test/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,24 @@ def test_basic_capture_with_locally_evaluated_feature_flags(self, patch_decide):
"payloads": {"true": 300},
},
}
client.feature_flags = [multivariate_flag, basic_flag]
false_flag = {
"id": 1,
"name": "Beta Feature",
"key": "false-flag",
"is_simple_flag": True,
"active": True,
"filters": {
"groups": [
{
"properties": [
],
"rollout_percentage": 0,
}
],
"payloads": {"true": 300},
},
}
client.feature_flags = [multivariate_flag, basic_flag, false_flag]

success, msg = client.capture("distinct_id", "python test event")
client.flush()
Expand All @@ -176,6 +193,7 @@ def test_basic_capture_with_locally_evaluated_feature_flags(self, patch_decide):
self.assertEqual(msg["properties"]["$lib"], "posthog-python")
self.assertEqual(msg["properties"]["$lib_version"], VERSION)
self.assertEqual(msg["properties"]["$feature/beta-feature-local"], "third-variant")
self.assertEqual(msg["properties"]["$feature/false-flag"], False)
self.assertEqual(msg["properties"]["$active_feature_flags"], ["beta-feature-local"])
assert "$feature/beta-feature" not in msg["properties"]

Expand All @@ -189,6 +207,7 @@ def test_basic_capture_with_locally_evaluated_feature_flags(self, patch_decide):
self.assertFalse(self.failed)
assert "$feature/beta-feature" not in msg["properties"]
assert "$feature/beta-feature-local" not in msg["properties"]
assert "$feature/false-flag" not in msg["properties"]
assert "$active_feature_flags" not in msg["properties"]

@mock.patch("posthog.client.decide")
Expand Down

0 comments on commit f290b96

Please sign in to comment.