Do not check default value.

see #1061
This commit is contained in:
Antoine Nguyen
2017-03-07 14:31:40 +01:00
parent 9e07b6bafb
commit 9b9df94e15
2 changed files with 13 additions and 4 deletions
@@ -45,8 +45,10 @@ class Command(BaseCommand):
user=admin, content_object=admin, is_owner=True)
lc = models.LocalConfig.objects.first()
secret_key = lc.parameters.get_value("secret_key")
if not secret_key:
condition = (
"core" not in lc._parameters or
"secret_key" not in lc._parameters["core"])
if condition:
lc.parameters.set_value("secret_key", random_key())
lc.save()
+9 -2
View File
@@ -42,16 +42,23 @@ class AuthenticationTestCase(ModoTestCase):
self.assertTrue(response.url.endswith(reverse("core:dashboard")))
class ChangeDefaultAdminTestCase(TestCase):
class LoadInitialDataTestCase(TestCase):
"""Try to change the default username."""
def test_management_command(self):
def test_change_default_admin(self):
"""Use dedicated option."""
management.call_command(
"load_initial_data", "--admin-username", "modoadmin")
self.assertTrue(
self.client.login(username="modoadmin", password="password"))
def test_set_secret_key(self):
"""Use dedicated option."""
management.call_command("load_initial_data")
lc = models.LocalConfig.objects.first()
self.assertIn("core", lc._parameters)
self.assertIn("secret_key", lc._parameters["core"])
class ProfileTestCase(ModoTestCase):
"""Profile related tests."""