Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

Dummy (plain text) password hashing for Django.

Project description

Dummy (plain text) password hashing for Django… for use in tests!

Speed up tests!

Cryptography is greedy. When you run tests, you usually do not care about password security, but you care about performances. Using dummy password hashing speeds up tests!

Install django-plainpasswordhasher with your favorite installer. Here is an example using pip:

pip install django-plainpasswordhasher

Then configure your test settings:

PASSWORD_HASHERS = ('django_plainpasswordhasher.PlainPasswordHasher', )

Except explicit password hashing tests

In most cases, using a dummy password hasher will do the job. But you may write some tests that require real password hashing. In such a case, let’s override settings!

from django.conf import global_settings  # Django default settings...
                                         # You may use your project's
                                         # default settings instead.
from django.test import TestCase
from django.test.utils import override_settings

class CryptographyTestCase(TestCase):
     """Tests that require real cryptography."""

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date (10.8 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page