test: Add test case to validate user signup throttling

This commit is contained in:
Suraj Shetty 2021-08-17 14:33:34 +05:30
parent ddf4bb80b8
commit ba369da61b

View file

@ -283,6 +283,11 @@ class TestUser(unittest.TestCase):
self.assertTupleEqual(sign_up(random_user, random_user_name, "/welcome"), (0, "Registered but disabled"))
# throttle user creation
with patch.object(user_module.frappe.db, "get_creation_count", return_value=301):
self.assertRaisesRegex(frappe.exceptions.ValidationError, "Throttled",
sign_up, frappe.mock('email'), random_user_name, "/signup")
def test_reset_password(self):
from frappe.utils import set_request