mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-09 03:36:48 +00:00
test: a fast password hash for the test suite
Tests create and log in users for most test cases; Django's default PBKDF2 hash made that half of the suite's time (260 s -> 124 s locally with MD5). The fast hasher is set only when the command is manage.py test.
This commit is contained in:
parent
61ec138cfa
commit
31d979bd29
1 changed files with 5 additions and 0 deletions
|
|
@ -4,6 +4,7 @@ Django settings for webvirtcloud project.
|
|||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
try:
|
||||
import ldap
|
||||
from django_auth_ldap.config import LDAPSearch, NestedActiveDirectoryGroupType
|
||||
|
|
@ -172,6 +173,10 @@ AUTHENTICATION_BACKENDS = [
|
|||
|
||||
LOGIN_URL = "/accounts/login/"
|
||||
|
||||
# Tests create users by the thousand: a fast hash for them (manage.py test only)
|
||||
if sys.argv[1:2] == ["test"]:
|
||||
PASSWORD_HASHERS = ["django.contrib.auth.hashers.MD5PasswordHasher"]
|
||||
|
||||
# Failed logins (django-axes): a user is locked for the address the logins
|
||||
# come from. The limit and the lock time are on the Settings page
|
||||
# (LOGIN_FAILURE_LIMIT, LOGIN_LOCKOUT_MINUTES); unlock with
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue