From f290b965e4e1d7a2f29728f3e2666a81824feacd Mon Sep 17 00:00:00 2001 From: Neil Kakkar Date: Wed, 8 Nov 2023 15:07:18 +0000 Subject: [PATCH] add false flag --- posthog/test/test_client.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/posthog/test/test_client.py b/posthog/test/test_client.py index 7d02a53..802b7ef 100644 --- a/posthog/test/test_client.py +++ b/posthog/test/test_client.py @@ -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() @@ -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"] @@ -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")