Andrei Neagoie Python
# Register user try: user = auth_service.register_user("user@example.com", "MySecurePass123!") print(f"✅ User registered: user.email") except ValidationError as e: print(f"❌ Registration failed: e")
Args: key: Identifier for rate limiting (e.g., email or IP) andrei neagoie python
Returns: String containing salt and hash separated by colon # Register user try: user = auth_service
Returns: Created User object
def test_account_lockout(self, auth_service): auth_service.register_user("test@example.com", "ValidPass123!") andrei neagoie python
self.users[email] = user return user
# 6th attempt should trigger rate limit with pytest.raises(RateLimitExceededError): auth_service.login("test@example.com", "wrong", ip)