Skip to main content

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

@override_settings(PASSWORD_HASHERS=global_settings.PASSWORD_HASHERS)
class CryptographyTestCase(TestCase):
     """Tests that require real cryptography."""

Resources

References

Project details


Download files

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

Source Distribution

django-plainpasswordhasher-0.3.zip (10.8 kB view details)

Uploaded Source

File details

Details for the file django-plainpasswordhasher-0.3.zip.

File metadata

File hashes

Hashes for django-plainpasswordhasher-0.3.zip
Algorithm Hash digest
SHA256 e5cd99074b735da6ecbcd71711404e5e953d4c6579fbc34732a094a9de6167e4
MD5 9b359a7912906bd4928fdfbe11ef210d
BLAKE2b-256 2bb07bc9cae1e570144e907fa9e72e2dbe4ea9c9f7fb11d878e8a63ab86e33b8

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page