Пример #1
0
def get_manager():
    alembic_path = os.path.join(os.path.dirname(__file__),
                                '..', 'db', 'alembic.ini')
    migrate_path = os.path.join(os.path.dirname(__file__),
                                '..', 'db', 'alembic')
    migration_config = {'alembic_ini_path': alembic_path,
                        'alembic_repo_path': migrate_path,
                        'db_url': CONF.database.connection}
    return migration_manager.MigrationManager(migration_config)
Пример #2
0
 def setUp(self):
     self.migration_config = {
         'alembic_ini_path': '.',
         'migrate_repo_path': '.',
         'db_url': 'sqlite://'
     }
     self.migration_manager = manager.MigrationManager(
         self.migration_config)
     self.ext = mock.Mock()
     self.migration_manager._manager.extensions = [self.ext]
     super(TestMigrationManager, self).setUp()
Пример #3
0
 def setUp(self):
     self.migration_config = {
         'alembic_ini_path': '.',
         'migrate_repo_path': '.',
         'db_url': 'sqlite://'
     }
     engine = sqlalchemy.create_engine(self.migration_config['db_url'])
     self.migration_manager = manager.MigrationManager(
         self.migration_config, engine)
     self.ext = mock.Mock()
     self.ext.obj.version = mock.Mock(return_value=0)
     self.migration_manager._manager.extensions = [self.ext]
     super(TestMigrationManager, self).setUp()
Пример #4
0
 def setUp(self):
     self.migration_config = {
         'alembic_ini_path': '.',
         'migrate_repo_path': '.',
         'db_url': 'sqlite://'
     }
     self.migration_manager = manager.MigrationManager(
         self.migration_config)
     self.first_ext = MockWithCmp()
     self.first_ext.obj.order = 1
     self.first_ext.obj.upgrade.return_value = 100
     self.first_ext.obj.downgrade.return_value = 0
     self.second_ext = MockWithCmp()
     self.second_ext.obj.order = 2
     self.second_ext.obj.upgrade.return_value = 200
     self.second_ext.obj.downgrade.return_value = 100
     self.migration_manager._manager.extensions = [
         self.first_ext, self.second_ext
     ]
     super(TestMigrationRightOrder, self).setUp()