Esempio n. 1
0
 def test__get_error_message_Should_ReturnExpected_When_ResponseJson(
         self, *patches):
     client = RESTclient('hostname1.company.com')
     response_mock = Mock()
     response_mock.json.return_value = 'json value'
     result = client.get_error_message(response_mock)
     self.assertEqual(result, response_mock.json.return_value)
Esempio n. 2
0
 def test__get_error_message_ShouldReturnExpected_When_ResponseJsonValueError(
         self, *patches):
     client = RESTclient('hostname1.company.com')
     response_mock = Mock()
     response_mock.json.side_effect = ValueError()
     response_mock.text = 'text error'
     result = client.get_error_message(response_mock)
     self.assertEqual(result, response_mock.text)