Ejemplo n.º 1
0
    def test_pre_send_std():
        """Test the pre_send method."""
        rate_limit_handler = RateLimitHandler()
        response: Response = Response()
        type(response).ok = PropertyMock(True)
        response.headers = {
            'X-RateLimit-Remaining': 0,
            'X-RateLimit-Reset': 10
        }

        rate_limit_handler.post_send(response)

        request: PreparedRequest = PreparedRequest()

        rate_limit_handler.pre_send(request)
        time.sleep.assert_called_once_with(10)  # pylint: disable=no-member