def test_no_challenge(self):
     """The field is considered to be absent if there's no challenge Id."""
     widget = RecaptchaWidget(FAKE_RECAPTCHA_CLIENT)
     
     form_data = {'recaptcha_response_field': RANDOM_SOLUTION_TEXT}
     field_value = widget.value_from_datadict(
         form_data,
         _FAKE_FILES_DATA,
         _FAKE_FIELD_NAME,
         )
     eq_(None, field_value)
    def test_no_solution(self):
        """The field is considered to be absent if there's no solution."""
        widget = RecaptchaWidget(FAKE_RECAPTCHA_CLIENT)

        form_data = {'recaptcha_challenge_field': RANDOM_CHALLENGE_ID}
        field_value = widget.value_from_datadict(
            form_data,
            _FAKE_FILES_DATA,
            _FAKE_FIELD_NAME,
            )
        eq_(None, field_value)
Beispiel #3
0
    def test_no_challenge(self):
        """The field is considered to be absent if there's no challenge Id."""
        widget = RecaptchaWidget(FAKE_RECAPTCHA_CLIENT)

        form_data = {'recaptcha_response_field': RANDOM_SOLUTION_TEXT}
        field_value = widget.value_from_datadict(
            form_data,
            _FAKE_FILES_DATA,
            _FAKE_FIELD_NAME,
        )
        eq_(None, field_value)
Beispiel #4
0
    def test_no_solution(self):
        """The field is considered to be absent if there's no solution."""
        widget = RecaptchaWidget(FAKE_RECAPTCHA_CLIENT)

        form_data = {'recaptcha_challenge_field': RANDOM_CHALLENGE_ID}
        field_value = widget.value_from_datadict(
            form_data,
            _FAKE_FILES_DATA,
            _FAKE_FIELD_NAME,
        )
        eq_(None, field_value)
 def test_solution_and_challenge(self):
     widget = RecaptchaWidget(FAKE_RECAPTCHA_CLIENT)
     
     form_data = {
         'recaptcha_response_field': RANDOM_SOLUTION_TEXT,
         'recaptcha_challenge_field': RANDOM_CHALLENGE_ID,
         }
     field_value = widget.value_from_datadict(
         form_data,
         _FAKE_FILES_DATA,
         _FAKE_FIELD_NAME,
         )
     
     ok_('solution_text' in field_value)
     eq_(RANDOM_SOLUTION_TEXT, field_value['solution_text'])
     
     ok_('challenge_id' in field_value)
     eq_(RANDOM_CHALLENGE_ID, field_value['challenge_id'])
Beispiel #6
0
    def test_solution_and_challenge(self):
        widget = RecaptchaWidget(FAKE_RECAPTCHA_CLIENT)

        form_data = {
            'recaptcha_response_field': RANDOM_SOLUTION_TEXT,
            'recaptcha_challenge_field': RANDOM_CHALLENGE_ID,
        }
        field_value = widget.value_from_datadict(
            form_data,
            _FAKE_FILES_DATA,
            _FAKE_FIELD_NAME,
        )

        ok_('solution_text' in field_value)
        eq_(RANDOM_SOLUTION_TEXT, field_value['solution_text'])

        ok_('challenge_id' in field_value)
        eq_(RANDOM_CHALLENGE_ID, field_value['challenge_id'])