summaryrefslogtreecommitdiff
path: root/tests/user_commands/tests.py
diff options
context:
space:
mode:
authorHasan Ramezani <hasan.r67@gmail.com>2018-08-05 00:52:50 +0430
committerTim Graham <timograham@gmail.com>2018-08-05 16:06:31 -0400
commit03e918d7179fd7e738261c7f4c242d6627333646 (patch)
tree291a30b4b1532bfc39acad43dba3786b8309f5d5 /tests/user_commands/tests.py
parent8b43e9b1af37ab222cbe2964ae13a9203afb9c92 (diff)
Added test for django.core.management.utils.get_random_secret_key().
Diffstat (limited to 'tests/user_commands/tests.py')
-rw-r--r--tests/user_commands/tests.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/user_commands/tests.py b/tests/user_commands/tests.py
index eb30065488..50b1b4244f 100644
--- a/tests/user_commands/tests.py
+++ b/tests/user_commands/tests.py
@@ -7,7 +7,9 @@ from admin_scripts.tests import AdminScriptTestCase
from django.apps import apps
from django.core import management
from django.core.management import BaseCommand, CommandError, find_commands
-from django.core.management.utils import find_command, popen_wrapper
+from django.core.management.utils import (
+ find_command, get_random_secret_key, popen_wrapper,
+)
from django.db import connection
from django.test import SimpleTestCase, override_settings
from django.test.utils import captured_stderr, extend_sys_path
@@ -260,3 +262,9 @@ class UtilsTests(SimpleTestCase):
msg = 'Error executing a_42_command_that_doesnt_exist_42'
with self.assertRaisesMessage(CommandError, msg):
popen_wrapper(['a_42_command_that_doesnt_exist_42'])
+
+ def test_get_random_secret_key(self):
+ key = get_random_secret_key()
+ self.assertEqual(len(key), 50)
+ for char in key:
+ self.assertIn(char, 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)')