diff options
author | 2022-11-05 13:39:52 +0000 | |
---|---|---|
committer | 2022-11-05 14:05:00 +0000 | |
commit | 962968fecedca3bef33ba9524d87ffedf815f16d (patch) | |
tree | 3dd7b6c6cae4f01c8a5aae3e2371bd3a5e9dd0e7 /tests/botcore/test_api.py | |
parent | Update pyproject.toml module meta data (diff) |
Rename package due to naming conflict
Diffstat (limited to 'tests/botcore/test_api.py')
-rw-r--r-- | tests/botcore/test_api.py | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/tests/botcore/test_api.py b/tests/botcore/test_api.py deleted file mode 100644 index 86c9e5f3..00000000 --- a/tests/botcore/test_api.py +++ /dev/null @@ -1,69 +0,0 @@ -import unittest -from unittest.mock import MagicMock - -from botcore import site_api - - -class APIClientTests(unittest.IsolatedAsyncioTestCase): - """Tests for botcore's site API client.""" - - @classmethod - def setUpClass(cls): - """Sets up the shared fixtures for the tests.""" - cls.error_api_response = MagicMock() - cls.error_api_response.status = 999 - - def test_response_code_error_default_initialization(self): - """Test the default initialization of `ResponseCodeError` without `text` or `json`""" - error = site_api.ResponseCodeError(response=self.error_api_response) - - self.assertIs(error.status, self.error_api_response.status) - self.assertEqual(error.response_json, {}) - self.assertEqual(error.response_text, None) - self.assertIs(error.response, self.error_api_response) - - def test_response_code_error_string_representation_default_initialization(self): - """Test the string representation of `ResponseCodeError` initialized without text or json.""" - error = site_api.ResponseCodeError(response=self.error_api_response) - self.assertEqual( - str(error), - f"Status: {self.error_api_response.status} Response: {None}" - ) - - def test_response_code_error_initialization_with_json(self): - """Test the initialization of `ResponseCodeError` with json.""" - json_data = {'hello': 'world'} - error = site_api.ResponseCodeError( - response=self.error_api_response, - response_json=json_data, - ) - self.assertEqual(error.response_json, json_data) - self.assertEqual(error.response_text, None) - - def test_response_code_error_string_representation_with_nonempty_response_json(self): - """Test the string representation of `ResponseCodeError` initialized with json.""" - json_data = {'hello': 'world'} - error = site_api.ResponseCodeError( - response=self.error_api_response, - response_json=json_data - ) - self.assertEqual(str(error), f"Status: {self.error_api_response.status} Response: {json_data}") - - def test_response_code_error_initialization_with_text(self): - """Test the initialization of `ResponseCodeError` with text.""" - text_data = 'Lemon will eat your soul' - error = site_api.ResponseCodeError( - response=self.error_api_response, - response_text=text_data, - ) - self.assertEqual(error.response_text, text_data) - self.assertEqual(error.response_json, {}) - - def test_response_code_error_string_representation_with_nonempty_response_text(self): - """Test the string representation of `ResponseCodeError` initialized with text.""" - text_data = 'Lemon will eat your soul' - error = site_api.ResponseCodeError( - response=self.error_api_response, - response_text=text_data - ) - self.assertEqual(str(error), f"Status: {self.error_api_response.status} Response: {text_data}") |