'Context manager for mocking a disabled captcha.
Will raise an AssertionError if the captcha code is called.'

def disabled_captcha(self):

    return contextlib.nested(patch.object(validator, 'need_provider_captcha', return_value=False), patch.object(g.captcha_provider, 'validate_captcha', side_effect=AssertionError))
