def test_send_request(self): rsp = client.send_request(url=self.url, method='hi', body='wawa') self.assertIsNotNone(rsp, '应答为空') self.assertIsInstance(rsp.status, int, '应答码不为整数') self.assertIsNotNone(rsp.body, '应答码不为整数') self.assertIsNotNone(rsp.request, '应答里得不到请求') self.assertEqual(rsp.request.method, 'hi') self.assertEqual(rsp.request.body, 'wawa')
def test_sync_one(): try: client.send_request(url=url, method='hi', timeout=5) except TimeoutException: global timeout_count timeout_count += 1
def test_send_timeout(self): with self.assertRaises(TimeoutException): client.send_request(url=self.url, method='sleep', body='6', timeout=1)