Skip to content

Commit

Permalink
Update to support test SECRET_KEY generation when running Django <1.1…
Browse files Browse the repository at this point in the history
…0 tests

Still uses same char set and length of keys generated that Django get_random_secret_key() does.  Not that important since only used for testing anyway.
  • Loading branch information
JonathanWillitts committed Apr 29, 2021
1 parent 657a074 commit 74b8bb2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import random

from django.conf import settings
from django.core.management.utils import get_random_secret_key


def pytest_configure():
settings.configure(
Expand Down Expand Up @@ -34,5 +36,8 @@ def pytest_configure():
],
},
}],
SECRET_KEY=get_random_secret_key()
SECRET_KEY=''.join(
random.choice("abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)")
for _ in range(50)
),
)

0 comments on commit 74b8bb2

Please sign in to comment.