async def test_http_batch_request_close_session(self, session):
        mocked__send = asynctest.CoroutineMock()
        http = requests.AsyncHTTPBatchRequest(session=session)
        http._send = mocked__send
        await http.close()

        session.close.assert_called()
        mocked__send.assert_called()
    async def test_http_batch_request_max_batch_size(self, session):
        call_count = 50
        async with requests.AsyncHTTPBatchRequest(session=session) as http:
            for _ in range(call_count):
                await http.send({"foo": "bar"})

        max_batch_size = requests.AsyncHTTPBatchRequest.max_batch_size
        expected_call_count = math.ceil(call_count / max_batch_size)
        assert session.post.call_count == expected_call_count
    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]))