Selaa lähdekoodia

Tested showmigrations with apps without migrations.

Tim Graham 6 vuotta sitten
vanhempi
commit
4fc8fb7dda
1 muutettua tiedostoa jossa 11 lisäystä ja 0 poistoa
  1. 11 0
      tests/migrations/test_commands.py

+ 11 - 0
tests/migrations/test_commands.py

@@ -373,6 +373,17 @@ class MigrateTests(MigrationTestBase):
             call_command('migrate', 'migrations', '0003', fake=True, verbosity=0)
         call_command('migrate', 'migrations', 'zero', verbosity=0)
 
+    @override_settings(MIGRATION_MODULES={'migrations': 'migrations.test_migrations_empty'})
+    def test_showmigrations_no_migrations(self):
+        out = io.StringIO()
+        call_command('showmigrations', stdout=out, no_color=True)
+        self.assertEqual('migrations\n (no migrations)\n', out.getvalue().lower())
+
+    @override_settings(INSTALLED_APPS=['migrations.migrations_test_apps.unmigrated_app'])
+    def test_showmigrations_unmigrated_app(self):
+        with self.assertRaisesMessage(CommandError, 'No migrations present for: unmigrated_app'):
+            call_command('showmigrations', 'unmigrated_app')
+
     @override_settings(MIGRATION_MODULES={"migrations": "migrations.test_migrations_empty"})
     def test_showmigrations_plan_no_migrations(self):
         """