Esempio n. 1
0
 def test_204_check_run(self):
     """Assert HTTP 204 responses are treated specially."""
     kwargs = {key: mock.Mock() for key in ('server_config', 'response')}
     kwargs['response'].status_code = 204
     with mock.patch.object(api, '_handle_202'):
         api.json_handler(**kwargs)
     self.assertEqual(kwargs['response'].json.call_count, 0)
Esempio n. 2
0
 def test_204_check_run(self):
     """Assert HTTP 204 responses are treated specially."""
     kwargs = {key: mock.Mock() for key in _HANDLER_ARGS}
     kwargs['response'].status_code = 204
     with mock.patch.object(api, '_handle_202'):
         api.json_handler(**kwargs)
     self.assertEqual(kwargs['response'].json.call_count, 0)
Esempio n. 3
0
 def test_204_check_run(self):
     """Assert HTTP 204 responses are treated specially."""
     kwargs = {key: mock.Mock() for key in _HANDLER_ARGS}
     kwargs["response"].status_code = 204
     with mock.patch.object(api, "_handle_202"):
         api.json_handler(**kwargs)
     self.assertEqual(kwargs["response"].json.call_count, 0)
Esempio n. 4
0
 def test_202_check_run(self):
     """Assert HTTP 202 responses are treated specially."""
     kwargs = {key: mock.Mock() for key in _HANDLER_ARGS}
     with mock.patch.object(api, '_handle_202') as handle_202:
         api.json_handler(**kwargs)
     self.assertEqual(handle_202.call_count, 1)
Esempio n. 5
0
 def test_raise_for_status(self):
     """Assert ``response.raise_for_status()`` is called."""
     kwargs = {key: mock.Mock() for key in _HANDLER_ARGS}
     api.json_handler(**kwargs)
     self.assertEqual(kwargs['response'].raise_for_status.call_count, 1)
Esempio n. 6
0
 def test_return(self):
     """Assert the JSON-decoded body of ``response`` is returned."""
     kwargs = {key: mock.Mock() for key in _HANDLER_ARGS}
     out = api.json_handler(**kwargs)
     self.assertEqual(kwargs['response'].json.return_value, out)
Esempio n. 7
0
 def test_202_check_run(self):
     """Assert HTTP 202 responses are treated specially."""
     kwargs = {key: mock.Mock() for key in ('server_config', 'response')}
     with mock.patch.object(api, '_handle_202') as handle_202:
         api.json_handler(**kwargs)
     self.assertEqual(handle_202.call_count, 1)
Esempio n. 8
0
 def test_raise_for_status(self):
     """Assert ``response.raise_for_status()`` is called."""
     kwargs = {key: mock.Mock() for key in ('server_config', 'response')}
     api.json_handler(**kwargs)
     self.assertEqual(kwargs['response'].raise_for_status.call_count, 1)
Esempio n. 9
0
 def test_return(self):
     """Assert the JSON-decoded body of ``response`` is returned."""
     kwargs = {key: mock.Mock() for key in ('server_config', 'response')}
     out = api.json_handler(**kwargs)
     self.assertEqual(kwargs['response'].json.return_value, out)
Esempio n. 10
0
 def test_202_check_run(self):
     """Assert HTTP 202 responses are treated specially."""
     kwargs = {key: mock.Mock() for key in _HANDLER_ARGS}
     with mock.patch.object(api, "_handle_202") as handle_202:
         api.json_handler(**kwargs)
     self.assertEqual(handle_202.call_count, 1)
Esempio n. 11
0
 def test_raise_for_status(self):
     """Assert ``response.raise_for_status()`` is called."""
     kwargs = {key: mock.Mock() for key in _HANDLER_ARGS}
     api.json_handler(**kwargs)
     self.assertEqual(kwargs["response"].raise_for_status.call_count, 1)
Esempio n. 12
0
 def test_return(self):
     """Assert the JSON-decoded body of ``response`` is returned."""
     kwargs = {key: mock.Mock() for key in _HANDLER_ARGS}
     out = api.json_handler(**kwargs)
     self.assertEqual(kwargs["response"].json.return_value, out)