def test_throttle(throttle_app: TestApp, test_request):
"""Throttling should give us 429."""
app = throttle_app
# clear counter from previous test run
clear_throttle(test_request, "throttle_sample")
app.get("/", status=200)
# We exceeded the limit of 1 request per hour
app.get("/", status=429)
# Let's clear the counter
clear_throttle(test_request, "throttle_sample")
app.get("/", status=200)
评论列表
文章目录