Skip to content

Commit feb9560

Browse files
committed
please work
1 parent b114a48 commit feb9560

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

posthog/test/test_feature_flags.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2341,13 +2341,9 @@ def test_capture_is_called(self, patch_decide, patch_capture):
23412341
@mock.patch.object(Client, "capture")
23422342
@mock.patch("posthog.client.decide")
23432343
def test_capture_is_called_in_get_feature_flag_payload(self, patch_decide, patch_capture):
2344-
# Mock the decide response
23452344
patch_decide.return_value = {"featureFlags": {"decide-flag": "decide-value"}, "featureFlagPayloads": {"person-flag": 300}}
2346-
2347-
# Initialize the Client with necessary keys
23482345
client = Client(api_key=FAKE_TEST_API_KEY, personal_api_key=FAKE_TEST_API_KEY)
23492346

2350-
# Set up feature flags
23512347
client.feature_flags = [
23522348
{
23532349
"id": 1,
@@ -2373,10 +2369,8 @@ def test_capture_is_called_in_get_feature_flag_payload(self, patch_decide, patch
23732369
person_properties={"region": "USA", "name": "Aloha"}
23742370
)
23752371

2376-
# Assert that capture was called once
2372+
# Assert that capture was called once, with the correct parameters
23772373
self.assertEqual(patch_capture.call_count, 1)
2378-
2379-
# Verify the capture was called with the correct parameters
23802374
patch_capture.assert_called_with(
23812375
"some-distinct-id",
23822376
"$feature_flag_called",
@@ -2394,7 +2388,7 @@ def test_capture_is_called_in_get_feature_flag_payload(self, patch_decide, patch
23942388
patch_capture.reset_mock()
23952389
patch_decide.reset_mock()
23962390

2397-
# Call get_feature_flag_payload again for the same user; capture should not be called again
2391+
# Call get_feature_flag_payload again for the same user; capture should not be called again because we've already reported an event for this distinct_id + flag
23982392
client.get_feature_flag_payload(
23992393
key="complex-flag",
24002394
distinct_id="some-distinct-id",
@@ -2411,7 +2405,6 @@ def test_capture_is_called_in_get_feature_flag_payload(self, patch_decide, patch
24112405
person_properties={"region": "USA", "name": "Aloha"}
24122406
)
24132407

2414-
# self.assertIsNotNone(payload)
24152408
self.assertEqual(patch_capture.call_count, 1)
24162409
patch_capture.assert_called_with(
24172410
"some-distinct-id2",

0 commit comments

Comments
 (0)