File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
tests/apps/migrations/commands Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 66from piccolo .apps .migrations .tables import Migration
77from piccolo .apps .migrations .commands .backwards import backwards
88from piccolo .apps .migrations .commands .forwards import forwards
9+ from tests .base import postgres_only
910from tests .example_app .tables import (
1011 Band ,
1112 Concert ,
2930]
3031
3132
33+ @postgres_only
3234class TestForwardsBackwards (TestCase ):
3335 """
3436 How to test this? Add migrations for the example app, and just run them
Original file line number Diff line number Diff line change 66from piccolo .apps .migrations .commands .new import (
77 _create_new_migration ,
88 BaseMigrationManager ,
9+ new ,
910)
1011
12+ from tests .base import postgres_only
1113from tests .example_app .tables import Manager
1214
1315
1416class TestNewMigrationCommand (TestCase ):
1517 def test_create_new_migration (self ):
18+ """
19+ Create a manual migration (i.e. non-auto).
20+ """
1621 migration_folder = "/tmp/piccolo_migrations/"
1722
1823 if os .path .exists (migration_folder ):
@@ -33,3 +38,15 @@ def test_create_new_migration(self):
3338 )
3439
3540 self .assertTrue (len (migration_modules .keys ()) == 1 )
41+
42+ @postgres_only
43+ def test_new_command (self ):
44+ """
45+ Call the command, when no migration changes are needed.
46+ """
47+ with self .assertRaises (SystemExit ) as manager :
48+ new (app_name = "example_app" , auto = True )
49+
50+ self .assertEqual (
51+ manager .exception .__str__ (), "No changes detected - exiting."
52+ )
You can’t perform that action at this time.
0 commit comments