Skip to content

Commit

Permalink
fix template path and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrejZbin committed Jan 12, 2022
1 parent aadc499 commit 776a686
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 19 deletions.
30 changes: 15 additions & 15 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Django hCaptcha provides a simple way to protect your django forms using `hCaptc
Configuration
-------------

Add "django-hcaptcha" to your INSTALLED_APPS setting like this::
Add "hcaptcha" to your INSTALLED_APPS setting like this::

INSTALLED_APPS = [
...
Expand Down Expand Up @@ -87,20 +87,20 @@ Unit Tests
--------------
You will need to disable the hCaptcha field in your unit tests, since your tests obviously cannot complete the hCaptcha successfully. One way to do so might be something like:

```
from unittest.mock import MagicMock, patch
.. code-block:: python
from django.test import TestCase
from unittest.mock import MagicMock, patch
@patch("hcaptcha.fields.hCaptchaField.validate", return_value=True)
class ContactTest(TestCase):
test_msg = {
"name": "pandora",
"message": "xyz",
"hcaptcha": "xxx", # Any truthy value is fine
}
from django.test import TestCase
@patch("hcaptcha.fields.hCaptchaField.validate", return_value=True)
class ContactTest(TestCase):
test_msg = {
"name": "pandora",
"message": "xyz",
"hcaptcha": "xxx", # Any truthy value is fine
}
def test_something(self, mock: MagicMock) -> None:
response = self.client.post("/contact/", self.test_msg)
self.assertEqual(response.status_code, HTTP_302_FOUND)
```
def test_something(self, mock: MagicMock) -> None:
response = self.client.post("/contact/", self.test_msg)
self.assertEqual(response.status_code, HTTP_302_FOUND)
File renamed without changes.
3 changes: 0 additions & 3 deletions hcaptcha/views.py

This file was deleted.

2 changes: 1 addition & 1 deletion hcaptcha/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


class hCaptchaWidget(forms.Widget):
template_name = 'hcaptcha_widget.html'
template_name = 'hcaptcha/forms/widgets/hcaptcha_widget.html'

def __init__(self, *args, **kwargs):
self.extra_url = {}
Expand Down

0 comments on commit 776a686

Please sign in to comment.