Skip to content

Commit

Permalink
test: fix tests description, improve tests stability by correct destr…
Browse files Browse the repository at this point in the history
…oy api object
  • Loading branch information
ilfa committed Jul 23, 2024
1 parent 231bdc0 commit 9b6677b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions test/test_fingerprint_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def setUp(self):
}

def tearDown(self):
del self.api
pass

@staticmethod
Expand Down Expand Up @@ -146,7 +147,7 @@ def test_get_visits_correct_data(self):
self.api.get_visits(mock_file2)

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

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

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

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

def test_get_event_error_404(self):
"""Test checks correct code run result in case of 403 error"""
"""Test checks correct code run result in case of 404 error for get_event method"""
mock_pool = MockPoolManager(self)
self.api.api_client.rest_client.pool_manager = mock_pool
mock_file = 'get_event_404_error.json'
Expand Down Expand Up @@ -306,6 +307,7 @@ def test_init_with_region(self):
regions_list = ["us", "eu", "ap"]
for region in regions_list:
configuration = Configuration(api_key=API_KEY, region=region)
del self.api
self.api = FingerprintApi(configuration) # noqa: E501
mock_pool = MockPoolManager(self)
self.api.api_client.rest_client.pool_manager = mock_pool
Expand Down Expand Up @@ -427,7 +429,7 @@ def test_update_event(self):
self.api.update_event(update_body, mock_file)

def test_update_event_400_error(self):
"""Test that delete visit method returns 400 error"""
"""Test that update event method returns 400 error"""
mock_pool = MockPoolManager(self)
self.api.api_client.rest_client.pool_manager = mock_pool

Expand Down

0 comments on commit 9b6677b

Please sign in to comment.