Tried to create test

This commit is contained in:
Spitap
2023-01-27 17:15:42 +01:00
parent 2e9f43d3a7
commit 126f3a7ea5
3 changed files with 6 additions and 2 deletions
+4
View File
@@ -224,10 +224,14 @@ class AccountViewSetTestCase(ModoAPITestCase):
self.assertIn("password", resp.json())
def test_validate(self):
"""Test validate and throttling."""
data = {"username": "toto@test.com"}
url = reverse("v2:account-validate")
resp = self.client.post(url, data, format="json")
self.assertEqual(resp.status_code, 204)
for _ in range(500):
resp = self.client.post(url, data, format="json")
self.assertEqual(resp.status_code, 429)
def test_random_password(self):
url = reverse("v2:account-random-password")
+1 -1
View File
@@ -12,6 +12,6 @@ class UserDosThrottle(SimpleRateThrottle):
ident = self.get_ident(request)
return self.cache_format % {
'scope': id(view),
'scope': id(view.action),
'ident': ident
}
+1 -1
View File
@@ -194,7 +194,7 @@ REST_FRAMEWORK = {
'DEFAULT_THROTTLE_RATES': {
'anon': '100/hour',
'login': '3/minute',
'ddos': '100/minute',
'ddos': '300/minute',
'password_recovery_request': '6/hour',
'password_recovery_totp_check': '20/hour',
'password_recovery_apply': '20/hour'