summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2014-09-09 05:02:20 +0000
committerGerrit Code Review <review@openstack.org>2014-09-09 05:02:20 +0000
commit8f7681946a62b5f835f267b68d02bf4c8aa7a0e2 (patch)
treea28ee3960cf109a015c2d2cf9b932094c4e1fe6c /tests
parentedf4c41e55829416c6195af73ad5cf0162906458 (diff)
parent49ae6c0446ec16993d6897543ee66f7ee6f22244 (diff)
downloadoslo-db-8f7681946a62b5f835f267b68d02bf4c8aa7a0e2.tar.gz
Merge "Renaming in WalkVersionsMixin"
Diffstat (limited to 'tests')
-rw-r--r--tests/sqlalchemy/test_migrations.py58
1 files changed, 29 insertions, 29 deletions
diff --git a/tests/sqlalchemy/test_migrations.py b/tests/sqlalchemy/test_migrations.py
index ed93c3d..df331d4 100644
--- a/tests/sqlalchemy/test_migrations.py
+++ b/tests/sqlalchemy/test_migrations.py
@@ -39,7 +39,7 @@ class TestWalkVersions(test.BaseTestCase, migrate.WalkVersionsMixin):
def test_migrate_up(self):
self.migration_api.db_version.return_value = 141
- self._migrate_up(141)
+ self.migrate_up(141)
self.migration_api.upgrade.assert_called_with(
self.engine, self.REPOSITORY, 141)
@@ -57,7 +57,7 @@ class TestWalkVersions(test.BaseTestCase, migrate.WalkVersionsMixin):
'upgrade',
side_effect=exc.DbMigrationError):
log = self.useFixture(fixtures.FakeLogger())
- self.assertRaises(exc.DbMigrationError, self._migrate_up, version)
+ self.assertRaises(exc.DbMigrationError, self.migrate_up, version)
self.assertEqual(expected_output, log.output)
def test_migrate_up_with_data(self):
@@ -67,7 +67,7 @@ class TestWalkVersions(test.BaseTestCase, migrate.WalkVersionsMixin):
self._pre_upgrade_141.return_value = test_value
self._check_141 = mock.MagicMock()
- self._migrate_up(141, True)
+ self.migrate_up(141, True)
self._pre_upgrade_141.assert_called_with(self.engine)
self._check_141.assert_called_with(self.engine, test_value)
@@ -75,7 +75,7 @@ class TestWalkVersions(test.BaseTestCase, migrate.WalkVersionsMixin):
def test_migrate_down(self):
self.migration_api.db_version.return_value = 42
- self.assertTrue(self._migrate_down(42))
+ self.assertTrue(self.migrate_down(42))
self.migration_api.db_version.assert_called_with(
self.engine, self.REPOSITORY)
@@ -83,23 +83,23 @@ class TestWalkVersions(test.BaseTestCase, migrate.WalkVersionsMixin):
with mock.patch.object(self.migration_api,
'downgrade',
side_effect=NotImplementedError):
- self.assertFalse(self._migrate_down(self.engine, 42))
+ self.assertFalse(self.migrate_down(self.engine, 42))
def test_migrate_down_with_data(self):
self._post_downgrade_043 = mock.MagicMock()
self.migration_api.db_version.return_value = 42
- self._migrate_down(42, True)
+ self.migrate_down(42, True)
self._post_downgrade_043.assert_called_with(self.engine)
- @mock.patch.object(migrate.WalkVersionsMixin, '_migrate_up')
- @mock.patch.object(migrate.WalkVersionsMixin, '_migrate_down')
- def test_walk_versions_all_default(self, _migrate_up, _migrate_down):
+ @mock.patch.object(migrate.WalkVersionsMixin, 'migrate_up')
+ @mock.patch.object(migrate.WalkVersionsMixin, 'migrate_down')
+ def test_walk_versions_all_default(self, migrate_up, migrate_down):
self.REPOSITORY.latest = 20
self.migration_api.db_version.return_value = self.INIT_VERSION
- self._walk_versions()
+ self.walk_versions()
self.migration_api.version_control.assert_called_with(
self.engine, self.REPOSITORY, self.INIT_VERSION)
@@ -109,18 +109,18 @@ class TestWalkVersions(test.BaseTestCase, migrate.WalkVersionsMixin):
versions = range(self.INIT_VERSION + 1, self.REPOSITORY.latest + 1)
upgraded = [mock.call(v, with_data=True)
for v in versions]
- self.assertEqual(self._migrate_up.call_args_list, upgraded)
+ self.assertEqual(self.migrate_up.call_args_list, upgraded)
downgraded = [mock.call(v - 1) for v in reversed(versions)]
- self.assertEqual(self._migrate_down.call_args_list, downgraded)
+ self.assertEqual(self.migrate_down.call_args_list, downgraded)
- @mock.patch.object(migrate.WalkVersionsMixin, '_migrate_up')
- @mock.patch.object(migrate.WalkVersionsMixin, '_migrate_down')
- def test_walk_versions_all_true(self, _migrate_up, _migrate_down):
+ @mock.patch.object(migrate.WalkVersionsMixin, 'migrate_up')
+ @mock.patch.object(migrate.WalkVersionsMixin, 'migrate_down')
+ def test_walk_versions_all_true(self, migrate_up, migrate_down):
self.REPOSITORY.latest = 20
self.migration_api.db_version.return_value = self.INIT_VERSION
- self._walk_versions(snake_walk=True, downgrade=True)
+ self.walk_versions(snake_walk=True, downgrade=True)
versions = range(self.INIT_VERSION + 1, self.REPOSITORY.latest + 1)
upgraded = []
@@ -128,7 +128,7 @@ class TestWalkVersions(test.BaseTestCase, migrate.WalkVersionsMixin):
upgraded.append(mock.call(v, with_data=True))
upgraded.append(mock.call(v))
upgraded.extend([mock.call(v) for v in reversed(versions)])
- self.assertEqual(upgraded, self._migrate_up.call_args_list)
+ self.assertEqual(upgraded, self.migrate_up.call_args_list)
downgraded_1 = [mock.call(v - 1, with_data=True) for v in versions]
downgraded_2 = []
@@ -136,15 +136,15 @@ class TestWalkVersions(test.BaseTestCase, migrate.WalkVersionsMixin):
downgraded_2.append(mock.call(v - 1))
downgraded_2.append(mock.call(v - 1))
downgraded = downgraded_1 + downgraded_2
- self.assertEqual(self._migrate_down.call_args_list, downgraded)
+ self.assertEqual(self.migrate_down.call_args_list, downgraded)
- @mock.patch.object(migrate.WalkVersionsMixin, '_migrate_up')
- @mock.patch.object(migrate.WalkVersionsMixin, '_migrate_down')
- def test_walk_versions_true_false(self, _migrate_up, _migrate_down):
+ @mock.patch.object(migrate.WalkVersionsMixin, 'migrate_up')
+ @mock.patch.object(migrate.WalkVersionsMixin, 'migrate_down')
+ def test_walk_versions_true_false(self, migrate_up, migrate_down):
self.REPOSITORY.latest = 20
self.migration_api.db_version.return_value = self.INIT_VERSION
- self._walk_versions(snake_walk=True, downgrade=False)
+ self.walk_versions(snake_walk=True, downgrade=False)
versions = range(self.INIT_VERSION + 1, self.REPOSITORY.latest + 1)
@@ -152,23 +152,23 @@ class TestWalkVersions(test.BaseTestCase, migrate.WalkVersionsMixin):
for v in versions:
upgraded.append(mock.call(v, with_data=True))
upgraded.append(mock.call(v))
- self.assertEqual(upgraded, self._migrate_up.call_args_list)
+ self.assertEqual(upgraded, self.migrate_up.call_args_list)
downgraded = [mock.call(v - 1, with_data=True) for v in versions]
- self.assertEqual(self._migrate_down.call_args_list, downgraded)
+ self.assertEqual(self.migrate_down.call_args_list, downgraded)
- @mock.patch.object(migrate.WalkVersionsMixin, '_migrate_up')
- @mock.patch.object(migrate.WalkVersionsMixin, '_migrate_down')
- def test_walk_versions_all_false(self, _migrate_up, _migrate_down):
+ @mock.patch.object(migrate.WalkVersionsMixin, 'migrate_up')
+ @mock.patch.object(migrate.WalkVersionsMixin, 'migrate_down')
+ def test_walk_versions_all_false(self, migrate_up, migrate_down):
self.REPOSITORY.latest = 20
self.migration_api.db_version.return_value = self.INIT_VERSION
- self._walk_versions(snake_walk=False, downgrade=False)
+ self.walk_versions(snake_walk=False, downgrade=False)
versions = range(self.INIT_VERSION + 1, self.REPOSITORY.latest + 1)
upgraded = [mock.call(v, with_data=True) for v in versions]
- self.assertEqual(upgraded, self._migrate_up.call_args_list)
+ self.assertEqual(upgraded, self.migrate_up.call_args_list)
class ModelsMigrationSyncMixin(test.BaseTestCase):