def METHOD_NAME(self):
    recipient = "exceeded_attemts@a.com"
    code = Code.create_for_user(user=self.new_user, recipient=recipient, length=settings.AUTH_CODE_LENGTH)
    # override the AUTH_MAX_CODE_TIMEDELTA setting
    with self.settings(AUTH_MAX_CODE_ATTEMPTS=1):
        # first attempt
        with self.assertRaises(InvalidCode):
            Code.check_code(recipient=recipient, code="wrong_attempt")
        # second attempt should rise ratelimit exception
        with self.assertRaises(RateLimitException):
            Code.check_code(recipient=recipient, code=code.code)