def test_throttling_compute_fine(SETTINGS):
SETTINGS.RATE_LIMIT_THRESHOLD = 0
from jenkins_epo.procedures import compute_throttling
# Consumed 1/5 calls at 2/3 of the time.
now = datetime(2017, 1, 18, 14, 40, tzinfo=timezone.utc)
reset = datetime(2017, 1, 18, 15, tzinfo=timezone.utc)
remaining = 4000
seconds = compute_throttling(
now=now,
rate_limit=dict(rate=dict(
limit=5000, remaining=remaining,
reset=reset.timestamp(),
)),
)
assert 0 == seconds # Fine !
评论列表
文章目录