Skip to content

Commit 521629c

Browse files
committed
test: fix 2 broken tests
1 parent 40e9e6a commit 521629c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test/test_fingerprint_api.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,11 @@ def test_get_visits_bad_text_data(self):
291291
mock_pool.expect_request('GET', TestFingerprintApi.get_visitors_path(visitor_id=mocked_id),
292292
fields=[self.integration_info], headers=self.request_headers,
293293
preload_content=True, timeout=None)
294-
with self.assertRaises(ValueError):
294+
with self.assertRaises(ApiException) as context:
295295
self.api.get_visits(mocked_id)
296+
self.assertEqual(context.exception.status, 200)
297+
self.assertIsInstance(context.exception.reason, ValueError)
298+
self.assertEqual(context.exception.body, 'really bad data')
296299

297300
def test_get_visits_bad_json_data(self):
298301
"""Test checks exception raising when client receives a bad JSON answer"""
@@ -302,8 +305,11 @@ def test_get_visits_bad_json_data(self):
302305
mock_pool.expect_request('GET', TestFingerprintApi.get_visitors_path(visitor_id=mocked_id),
303306
fields=[self.integration_info], headers=self.request_headers,
304307
preload_content=True, timeout=None)
305-
with self.assertRaises(ValueError):
308+
with self.assertRaises(ApiException) as context:
306309
self.api.get_visits(mocked_id)
310+
self.assertEqual(context.exception.status, 200)
311+
self.assertIsInstance(context.exception.reason, ValueError)
312+
self.assertEqual(context.exception.body, '{}')
307313

308314
def test_init_with_us_region(self):
309315
"""Test that link for us region generates correct"""

0 commit comments

Comments
 (0)