|
6 | 6 | from click.testing import CliRunner |
7 | 7 |
|
8 | 8 | from cloudinary_cli.cli import cli |
9 | | -from test.helper_test import api_response_mock, uploader_response_mock |
| 9 | +from test.helper_test import api_response_mock, uploader_response_mock, URLLIB3_REQUEST |
10 | 10 |
|
11 | 11 | API_MOCK_RESPONSE = api_response_mock() |
12 | 12 | UPLOAD_MOCK_RESPONSE = uploader_response_mock() |
|
15 | 15 | class TestCLIApi(unittest.TestCase): |
16 | 16 | runner = CliRunner() |
17 | 17 |
|
18 | | - @patch('urllib3.request.RequestMethods.request') |
| 18 | + @patch(URLLIB3_REQUEST) |
19 | 19 | def test_admin(self, mocker): |
20 | 20 | mocker.return_value = API_MOCK_RESPONSE |
21 | 21 | result = self.runner.invoke(cli, ['ping']) |
22 | 22 |
|
23 | 23 | self.assertEqual(0, result.exit_code, result.output) |
24 | 24 | self.assertIn('"foo": "bar"', result.output) |
25 | 25 |
|
26 | | - @patch('urllib3.request.RequestMethods.request') |
| 26 | + @patch(URLLIB3_REQUEST) |
27 | 27 | def test_upload(self, mocker): |
28 | 28 | mocker.return_value = UPLOAD_MOCK_RESPONSE |
29 | 29 | result = self.runner.invoke(cli, ['upload', os.path.abspath(__file__)]) |
30 | 30 |
|
31 | 31 | self.assertEqual(0, result.exit_code, result.output) |
32 | 32 | self.assertIn('"foo": "bar"', result.output) |
33 | 33 |
|
34 | | - @patch('urllib3.request.RequestMethods.request') |
| 34 | + @patch(URLLIB3_REQUEST) |
35 | 35 | @unittest.skipUnless(cloudinary.provisioning.account_config().account_id, "requires account_id") |
36 | 36 | def test_provisioning(self, mocker): |
37 | 37 | mocker.return_value = API_MOCK_RESPONSE |
|
0 commit comments