コード例 #1
0
    async def test_http_request(self, session):
        payload = {"foo": "bar"}
        async with requests.AsyncHTTPRequest(session=session) as http:
            await http.send(payload)

        session.post.assert_called_with(requests.AsyncHTTPRequest.endpoint,
                                        data=requests.encode_payload(payload))
コード例 #2
0
    async def test_http_batch_request(self, session):
        payload_1 = {"foo": "bar"}
        payload_2 = {"bar": "foo"}
        async with requests.AsyncHTTPBatchRequest(session=session) as http:
            await http.send(payload_1)
            await http.send(payload_2)

        session.post.assert_called_with(
            requests.AsyncHTTPBatchRequest.endpoint,
            data=requests.encode_payload([payload_1, payload_2]))