Rafał Pitoń 10 лет назад
Родитель
Сommit
34d1483b5c

+ 1 - 1
misago/core/management/commands/remakemisagochecksums.py

@@ -13,7 +13,7 @@ class Command(BaseCommand):
                             "in database with new ones, marking "
                             "all data as trusted. Are you sure "
                             "you wish to continue? [Y/n]")
-        if input(message).strip().lower() == "y":
+        if '--force' in args or input(message).strip().lower() == "y":
             self.stdout.write("\nRegenerating checksums...")
             secret_key_changed.send(self)
             self.stdout.write("\nDone!")

+ 15 - 0
misago/core/tests/test_remakemisagochecksums.py

@@ -0,0 +1,15 @@
+from django.test import TestCase
+from django.utils.six import StringIO
+
+from misago.core.management.commands import remakemisagochecksums
+
+
+class RemakeMisagoChecksumsTests(TestCase):
+    def test_remake_checksums(self):
+        """command raises no errors"""
+        command = remakemisagochecksums.Command()
+
+        out = StringIO()
+        command.execute("--force", stdout=out)
+        command_output = out.getvalue().splitlines()[-1].strip()
+        self.assertEqual(command_output, "Done!")