Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions docs/advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,28 @@ Use this for testing purposes. Warning: do NOT set this to True in production.

Defaults to: False

.. code:: python

from django.test import TestCase, Client
from django.urls import reverse
from captcha.conf import settings as captcha_settings

class ApplicationTestCase(TestCase):
def setUp(self):
self.client = Client()
self.url = reverse('application')
captcha_settings.CAPTCHA_TEST_MODE = True

def test_post_valid_form(self):
data = {
'name': 'Your Name',
"captcha_0": "any-random-string",
"captcha_1": "PASSED",
}

response = self.client.post(self.url, data)
self.assertEqual(response.status_code, 200)


CAPTCHA_GET_FROM_POOL
---------------------
Expand Down