Skip to content

Commit df9ae05

Browse files
committed
fix tests
1 parent b05ee38 commit df9ae05

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

posthog/test/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def mock_post_fn(*args, **kwargs):
208208

209209
# the post function should be called 2 times, with a batch size of 10
210210
# each time.
211-
with mock.patch('posthog.consumer.post', side_effect=mock_post_fn) \
211+
with mock.patch('posthog.consumer.batch_post', side_effect=mock_post_fn) \
212212
as mock_post:
213213
for _ in range(20):
214214
client.identify('distinct_id', {'trait': 'value'})
@@ -269,7 +269,7 @@ def test_feature_enabled_request(self, patch_get):
269269
'id': 1,
270270
'name': 'Beta Feature',
271271
'key': 'beta-feature',
272-
'is_simple_flag': False,
272+
'is_simple_flag': True,
273273
'rollout_percentage': 100
274274
}]
275275
self.assertTrue(client.feature_enabled('beta-feature', 'distinct_id'))

posthog/test/consumer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def test_flush_interval(self):
6060
flush_interval = 0.3
6161
consumer = Consumer(q, TEST_API_KEY, flush_at=10,
6262
flush_interval=flush_interval)
63-
with mock.patch('posthog.consumer.post') as mock_post:
63+
with mock.patch('posthog.consumer.batch_post') as mock_post:
6464
consumer.start()
6565
for i in range(0, 3):
6666
track = {
@@ -80,7 +80,7 @@ def test_multiple_uploads_per_interval(self):
8080
flush_at = 10
8181
consumer = Consumer(q, TEST_API_KEY, flush_at=flush_at,
8282
flush_interval=flush_interval)
83-
with mock.patch('posthog.consumer.post') as mock_post:
83+
with mock.patch('posthog.consumer.batch_post') as mock_post:
8484
consumer.start()
8585
for i in range(0, flush_at * 2):
8686
track = {
@@ -110,7 +110,7 @@ def mock_post(*args, **kwargs):
110110
raise expected_exception
111111
mock_post.call_count = 0
112112

113-
with mock.patch('posthog.consumer.post',
113+
with mock.patch('posthog.consumer.batch_post',
114114
mock.Mock(side_effect=mock_post)):
115115
track = {
116116
'type': 'track',

posthog/test/request.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ def test_valid_request(self):
1818
self.assertEqual(res.status_code, 200)
1919

2020
def test_invalid_request_error(self):
21-
self.assertRaises(Exception, post, 'testsecret',
21+
self.assertRaises(Exception, batch_post, 'testsecret',
2222
'https://t.posthog.com', False, '[{]')
2323

2424
def test_invalid_host(self):
25-
self.assertRaises(Exception, post, 'testsecret',
25+
self.assertRaises(Exception, batch_post, 'testsecret',
2626
't.posthog.com/', batch=[])
2727

2828
def test_datetime_serialization(self):

0 commit comments

Comments
 (0)