Skip to content

Commit 65fc737

Browse files
evanpurkhiserBYK
andauthored
fix(py3): Fix throttle message test due to float / int (#20207)
Co-authored-by: Burak Yigit Kaya <[email protected]>
1 parent c894543 commit 65fc737

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/sentry/api/test_handlers.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from __future__ import absolute_import
22

3+
import math
4+
35
from django.conf.urls import url
46
from django.test import override_settings
57
from rest_framework.permissions import AllowAny
@@ -27,4 +29,10 @@ def test_simple(self):
2729
self.login_as(self.user)
2830
resp = self.get_response()
2931
assert resp.status_code == 429
30-
assert resp.data["detail"] == "Request was throttled. Expected available in 1.0 second."
32+
33+
# DRF ceils our configured wait time, this produces a different number
34+
# type between 2 and 3. In 2 this produces a float, in 3 this produces
35+
# an integer.
36+
assert resp.data[
37+
"detail"
38+
] == u"Request was throttled. Expected available in {} second.".format(math.ceil(1))

0 commit comments

Comments
 (0)