Skip to content

Commit

Permalink
chore: remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
mbi committed Nov 15, 2024
1 parent b302363 commit 204d0c4
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 30 deletions.
10 changes: 0 additions & 10 deletions captcha/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,6 @@ def get_context(self, name, value, attrs):
context["audio"] = self.audio_url()
return context

def format_output(self, rendered_widgets):
# hidden_field, text_field = rendered_widgets
if self.output_format:
ret = self.output_format % {
"image": self.image_and_audio,
"hidden_field": self.hidden_field,
"text_field": self.text_field,
}
return ret

def render(self, name, value, attrs=None, renderer=None):
self.fetch_captcha_store(name, value, attrs, self.generator)

Expand Down
5 changes: 1 addition & 4 deletions captcha/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,7 @@ def tearDown(self):
settings.CAPTCHA_PUNCTUATION = self.__current_settings_punctuation

def _assertFormError(self, response, form_name, *args, **kwargs):
if django.VERSION >= (4, 1):
self.assertFormError(response.context.get(form_name), *args, **kwargs)
else:
self.assertFormError(response, form_name, *args, **kwargs)
self.assertFormError(response.context.get(form_name), *args, **kwargs)

def __extract_hash_and_response(self, r):
hash_ = re.findall(r'value="([0-9a-f]+)"', str(r.content))[0]
Expand Down
2 changes: 0 additions & 2 deletions captcha/tests/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
test_model_form,
test_model_serializer,
test_non_required,
test_per_form_format,
test_serializer,
)

Expand All @@ -25,7 +24,6 @@
re_path(
r"test2/$", test_custom_error_message, name="captcha-test-custom-error-message"
),
re_path(r"test3/$", test_per_form_format, name="test_per_form_format"),
re_path(r"custom-generator/$", test_custom_generator, name="test_custom_generator"),
re_path(
r"test-non-required/$", test_non_required, name="captcha-test-non-required"
Expand Down
14 changes: 0 additions & 14 deletions captcha/tests/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,20 +99,6 @@ class CaptchaTestErrorMessageForm(forms.Form):
return _test(request, CaptchaTestErrorMessageForm)


def test_per_form_format(request):
class CaptchaTestFormatForm(forms.Form):
captcha = CaptchaField(
help_text="asdasd",
error_messages=dict(invalid="TEST CUSTOM ERROR MESSAGE"),
output_format=(
"%(image)s testPerFieldCustomFormatString "
"%(hidden_field)s %(text_field)s"
),
)

return _test(request, CaptchaTestFormatForm)


def test_non_required(request):
class CaptchaTestForm(forms.Form):
sender = forms.EmailField()
Expand Down

0 comments on commit 204d0c4

Please sign in to comment.