Merge "Fix 0 version handling in migration_cli manager"
This commit is contained in:
commit
1f6103e4ef
@ -57,7 +57,7 @@ class MigrationManager(object):
|
||||
last = None
|
||||
for plugin in self._plugins:
|
||||
version = plugin.version()
|
||||
if version:
|
||||
if version is not None:
|
||||
last = version
|
||||
return last
|
||||
|
||||
|
@ -161,6 +161,7 @@ class TestMigrationManager(test_base.BaseTestCase):
|
||||
self.migration_manager = manager.MigrationManager(
|
||||
self.migration_config)
|
||||
self.ext = mock.Mock()
|
||||
self.ext.obj.version = mock.Mock(return_value=0)
|
||||
self.migration_manager._manager.extensions = [self.ext]
|
||||
super(TestMigrationManager, self).setUp()
|
||||
|
||||
@ -180,6 +181,10 @@ class TestMigrationManager(test_base.BaseTestCase):
|
||||
self.migration_manager.version()
|
||||
self.ext.obj.version.assert_called_once_with()
|
||||
|
||||
def test_version_return_value(self):
|
||||
version = self.migration_manager.version()
|
||||
self.assertEqual(0, version)
|
||||
|
||||
def test_revision_message_autogenerate(self):
|
||||
self.migration_manager.revision('test', True)
|
||||
self.ext.obj.revision.assert_called_once_with('test', True)
|
||||
|
Loading…
Reference in New Issue
Block a user