Skip to content

Commit 9b6677b

Browse files
committed
test: fix tests description, improve tests stability by correct destroy api object
1 parent 231bdc0 commit 9b6677b

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

test/test_fingerprint_api.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ def setUp(self):
102102
}
103103

104104
def tearDown(self):
105+
del self.api
105106
pass
106107

107108
@staticmethod
@@ -146,7 +147,7 @@ def test_get_visits_correct_data(self):
146147
self.api.get_visits(mock_file2)
147148

148149
def test_get_visits_error_403(self):
149-
"""Test checks correct code run result in case of 403 error"""
150+
"""Test checks correct code run result in case of 403 error for get_visits method"""
150151
mock_pool = MockPoolManager(self)
151152
self.api.api_client.rest_client.pool_manager = mock_pool
152153
mock_file = 'get_visits_403_error.json'
@@ -160,7 +161,7 @@ def test_get_visits_error_403(self):
160161
self.assertIsInstance(context.exception.structured_error, ErrorVisits403)
161162

162163
def test_get_visits_error_429(self):
163-
"""Test checks correct code run result in case of 429 error"""
164+
"""Test checks correct code run result in case of 429 error for get_visits method"""
164165
mock_pool = MockPoolManager(self)
165166
self.api.api_client.rest_client.pool_manager = mock_pool
166167
mock_file = 'get_visits_429_too_many_requests_error.json'
@@ -174,7 +175,7 @@ def test_get_visits_error_429(self):
174175
self.assertEqual(context.exception.structured_error.retry_after, 4)
175176

176177
def test_get_visits_error_429_empty_retry_after(self):
177-
"""Test checks correct code run result in case of 429 error"""
178+
"""Test checks retry after value in exception in case of 429 error for get_visits method"""
178179
mock_pool = MockPoolManager(self)
179180
self.api.api_client.rest_client.pool_manager = mock_pool
180181
mock_file = 'get_visits_429_too_many_requests_error_empty_header.json'
@@ -232,7 +233,7 @@ def test_get_event_errors_200(self):
232233
self.api.get_event(mock_file_all_errors)
233234

234235
def test_get_event_error_403(self):
235-
"""Test checks correct code run result in case of 403 error"""
236+
"""Test checks correct code run result in case of 403 error for get_event method"""
236237
mock_pool = MockPoolManager(self)
237238
self.api.api_client.rest_client.pool_manager = mock_pool
238239
mock_file = 'get_event_403_error.json'
@@ -245,7 +246,7 @@ def test_get_event_error_403(self):
245246
self.assertIsInstance(context.exception.structured_error, ErrorCommon403Response)
246247

247248
def test_get_event_error_404(self):
248-
"""Test checks correct code run result in case of 403 error"""
249+
"""Test checks correct code run result in case of 404 error for get_event method"""
249250
mock_pool = MockPoolManager(self)
250251
self.api.api_client.rest_client.pool_manager = mock_pool
251252
mock_file = 'get_event_404_error.json'
@@ -306,6 +307,7 @@ def test_init_with_region(self):
306307
regions_list = ["us", "eu", "ap"]
307308
for region in regions_list:
308309
configuration = Configuration(api_key=API_KEY, region=region)
310+
del self.api
309311
self.api = FingerprintApi(configuration) # noqa: E501
310312
mock_pool = MockPoolManager(self)
311313
self.api.api_client.rest_client.pool_manager = mock_pool
@@ -427,7 +429,7 @@ def test_update_event(self):
427429
self.api.update_event(update_body, mock_file)
428430

429431
def test_update_event_400_error(self):
430-
"""Test that delete visit method returns 400 error"""
432+
"""Test that update event method returns 400 error"""
431433
mock_pool = MockPoolManager(self)
432434
self.api.api_client.rest_client.pool_manager = mock_pool
433435

0 commit comments

Comments
 (0)