Impact factor for posts is a measurement of importance.

Impact factor for users reflect their authority, reputation and contribution on a particular topic.

Rating reflects the quality of posts.

Rating on Voofie is not a simple average of all ratings, but a weighted average of rating, weighted by the impact factor of users who rated.

Explore exciting communities of

How to skip Recaptcha in Django testing

14 Jan 10

Recaptcha is supposed to prevent robots from taking automated actions on your site.  However, it is not desirable to have recaptcha stop your Django automated testing. It is not desirable to manually turn off receptcha before testing as well.  This article provide a simple tips on how to disable Recaptcha for testing.

Bookmark and Share

To skip Recaptcha, we will make use of two different setting configuations, using two setting.py files, with one setting for production and one setting for testing.  First, we have to edit our program code so that the Recaptcha is configuable from setting.  Most often, Recaptcha is implemented as a form field. 

class RegistrationForm(forms.Form):
if settings.ENABLE_CAPTCHA:
recaptcha = ReCaptchaField()

By setting ENABLE_CAPTCHA = True in production setting.py, the Recaptcha field will be enabled.  Now create setting_testing.py file in the same directory as the setting.py file and have the following content:

from settings import *

ENABLE_CAPTCHA=False

The manage.py have to be changed as well to identify the setting_testing.py file.  Create a copy of manage.py as manage_testing.py, and import the setting_testing instead:

    import test_settings as settings # Assumed to be in the same directory.

Now run testing using manage_testing.py instead:

$ python manage_testing.py test

ReCaptchaField is now skipped and tests should be run smoothly

0 Comments

Please login to post comment.

What is Voofie?

Voofie organizes knowledge, discovers useful resources and recognizes knowledgable users.

Bookmark your blog in Voofie to get more traffic as well as building a reputation in your field!

Explore more about it. Become a member—our FREE Registration takes just seconds.

Page Info
10Impacts
0/0 rates
2120
Your Rating:
Version: 1
Submitted: 14 Jan 10
Permalink