def test_verify_wrong_arguments(self): client = ReCaptchaClient() response = client.verify('', 'test', '127.0.0.1') assert isinstance(httpretty.last_request(), httpretty.core.HTTPrettyRequestEmpty) assert not response.is_valid assert response.error_code == 'incorrect-captcha-sol'
def test_verify_wrong_arguments(self): client = ReCaptchaClient() response = client.verify('', 'test', '127.0.0.1') assert isinstance( httpretty.last_request(), httpretty.core.HTTPrettyRequestEmpty) assert not response.is_valid assert response.error_code == 'incorrect-captcha-sol'
def test_verify_sucess(self): args = urlencode(self.verify_data) httpretty.register_uri(httpretty.GET, 'https://www.google.com/recaptcha/api/verify?' + args, body='true\n\n', status=200, content_type='plain/text') client = ReCaptchaClient() response = client.verify('test', 'test', '127.0.0.1') last_request = httpretty.last_request() assert last_request.path.startswith('/recaptcha/api/verify') assert response.is_valid
def test_verify_sucess(self): args = urlencode(self.verify_data) httpretty.register_uri( httpretty.GET, 'https://www.google.com/recaptcha/api/verify?' + args, body='true\n\n', status=200, content_type='plain/text' ) client = ReCaptchaClient() response = client.verify('test', 'test', '127.0.0.1') last_request = httpretty.last_request() assert last_request.path.startswith('/recaptcha/api/verify') assert response.is_valid