|
2 | 2 | import unittest |
3 | 3 | from datetime import datetime |
4 | 4 | from uuid import uuid4 |
5 | | -from posthog.contexts import get_context_session_id, set_context_session, new_context |
6 | 5 |
|
7 | 6 | import mock |
8 | 7 | import six |
9 | 8 | from parameterized import parameterized |
10 | 9 |
|
11 | 10 | from posthog.client import Client |
| 11 | +from posthog.contexts import (get_context_session_id, new_context, |
| 12 | + set_context_session) |
12 | 13 | from posthog.request import APIError |
13 | 14 | from posthog.test.test_utils import FAKE_TEST_API_KEY |
14 | 15 | from posthog.types import FeatureFlag, LegacyFlagMetadata |
@@ -1923,9 +1924,9 @@ def test_mock_system_context( |
1923 | 1924 |
|
1924 | 1925 | # Set up platform-specific mocks |
1925 | 1926 | if platform_method: |
1926 | | - getattr( |
1927 | | - mock_platform, platform_method |
1928 | | - ).return_value = platform_return |
| 1927 | + getattr(mock_platform, platform_method).return_value = ( |
| 1928 | + platform_return |
| 1929 | + ) |
1929 | 1930 |
|
1930 | 1931 | # Special handling for Linux which uses distro module |
1931 | 1932 | if sys_platform == "linux": |
@@ -2057,7 +2058,7 @@ def test_set_context_session_with_page_explicit_properties(self): |
2057 | 2058 |
|
2058 | 2059 | def test_set_context_session_override_in_capture(self): |
2059 | 2060 | """Test that explicit session ID overrides context session ID in capture""" |
2060 | | - from posthog.contexts import set_context_session, new_context |
| 2061 | + from posthog.contexts import new_context, set_context_session |
2061 | 2062 |
|
2062 | 2063 | with mock.patch("posthog.client.batch_post") as mock_post: |
2063 | 2064 | client = Client(FAKE_TEST_API_KEY, on_error=self.set_fail, sync_mode=True) |
@@ -2158,6 +2159,7 @@ def test_get_remote_config_payload_works_without_poller(self, patch_remote_confi |
2158 | 2159 | self.assertEqual(result, {"test": "payload"}) |
2159 | 2160 | patch_remote_config.assert_called_once_with( |
2160 | 2161 | "test-personal-key", |
| 2162 | + FAKE_TEST_API_KEY, |
2161 | 2163 | client.host, |
2162 | 2164 | "test-flag", |
2163 | 2165 | timeout=client.feature_flags_request_timeout_seconds, |
@@ -2282,9 +2284,7 @@ def test_get_feature_flag_result_with_empty_string_payload(self, patch_batch_pos |
2282 | 2284 | } |
2283 | 2285 | ] |
2284 | 2286 | }, |
2285 | | - "payloads": { |
2286 | | - "empty-variant": "" # Empty string payload |
2287 | | - }, |
| 2287 | + "payloads": {"empty-variant": ""}, # Empty string payload |
2288 | 2288 | }, |
2289 | 2289 | } |
2290 | 2290 | ] |
|
0 commit comments