Esempio n. 1
0
 def test_call_helper_exception(self, transport):
     getresponse_mock = Mock()
     getresponse_mock.getresponse = Mock(side_effect=HTTPException)
     transport.return_value = getresponse_mock
     s = HttpLibHttpService('host', 42, 'path')
     with self.assertRaises(s.communication_error_class):
         s._call('body', {})
Esempio n. 2
0
 def test_call_helper(self, transport):
     getresponse_mock = Mock()
     transport.return_value = getresponse_mock
     read_mock = Mock()
     read_mock.read = Mock(return_value='data!')
     getresponse_mock.getresponse = Mock(return_value=read_mock)
     s = HttpLibHttpService('host', 42, 'path')
     r = s._call('body', {})
     self.assertIsInstance(r, tuple)
     self.assertEqual(len(r), 3)
Esempio n. 3
0
 def test_protocol_https(self):
     s = HttpLibHttpService('host', 443, 'path')
     self.assertEqual(s.protocol, HTTPSConnection._http_vsn_str)
     self.assertIsInstance(s.get_transport(), HTTPSConnection)