async def setUp(self): self.daemon = await tcp_daemon().open() self.client = tcp_client().open() self.api = RemoteAPI(self.client)
async def test_tcp_connection(self): async with tcp_daemon() as daemon: with tcp_client(daemon.host) as client: async with client.get('/') as res: self.assertEqual(res.status, 404)
def test_closed(self): client = tcp_client() self.assertTrue(client.is_closed()) with client: pass self.assertTrue(client.is_closed())
def test_closed_request(self): client = tcp_client() with self.assertRaises(ClientError): client.get('/')
def test_open(self): client = tcp_client() with client: self.assertFalse(client.is_closed())