Fixed #30186 -- Made showmigrations --list display the applied datetimes at verbosity 2+.

This commit is contained in:
tschilling 2019-03-07 10:52:10 -06:00 committed by Tim Graham
parent 371ddade1e
commit 7c68cea7ee
4 changed files with 30 additions and 4 deletions

View file

@ -250,6 +250,16 @@ class MigrateTests(MigrationTestBase):
' [ ] 0002_second\n',
out.getvalue().lower()
)
out = io.StringIO()
# Applied datetimes are displayed at verbosity 2+.
call_command('showmigrations', 'migrations', stdout=out, verbosity=2, no_color=True)
migration1 = MigrationRecorder(connection).migration_qs.get(app='migrations', name='0001_initial')
self.assertEqual(
'migrations\n'
' [x] 0001_initial (applied at %s)\n'
' [ ] 0002_second\n' % migration1.applied.strftime('%Y-%m-%d %H:%M:%S'),
out.getvalue().lower()
)
# Cleanup by unmigrating everything
call_command("migrate", "migrations", "zero", verbosity=0)