def exhaust(self, middleware, method, url, username, times):
        req = Request.blank(url, dict(REQUEST_METHOD=method),
                            headers={'X-Auth-User': username})
        req.environ['nova.context'] = context.RequestContext(username,
                            username)
        for i in range(times):
            resp = req.get_response(middleware)
            self.assertEqual(resp.status_int, 200)
        resp = req.get_response(middleware)
        self.assertEqual(resp.status_int, 413)
        self.assertTrue('Retry-After' in resp.headers)
dataset/ETHPy150Open nii-cloud/dodai-compute/nova/tests/api/openstack/__init__.py/RateLimitingMiddlewareTest.exhaust/original