# Path: pushmanager/core/db.py
# def UnsignedInteger():
# def init_db():
# def finalize_db():
# def execute_cb(query, callback_fn):
# def execute_transaction_cb(queries, callback_fn, condition=None):
# def prefix_insert_ignore(insert_ignore, compiler, **kw):
# def prefix_insert_ignore_sqlite(insert_ignore, compiler, **kw):
# class DatabaseError(Exception):
# class PushCheckList(Base):
# class PushPlans(Base):
# class PushPushContents(Base):
# class PushPushes(Base):
# class PushRemovals(Base):
# class PushRequests(Base):
# class InsertIgnore(Insert):
# 
# Path: pushmanager/testing/mocksettings.py



import os
import sqlalchemy as SA
import mock
import testify as T
from sqlalchemy.schema import Column
from sqlalchemy.schema import Table
from sqlalchemy.sql.compiler import SQLCompiler
from sqlalchemy.types import Integer
from pushmanager.core import db
from pushmanager.testing import testdb
from pushmanager.testing.mocksettings import MockedSettings
from pushmanager.testing.testdb import FakeDataMixin
#!/usr/bin/env python





class CoreDBTest(T.TestCase, FakeDataMixin):

    @T.class_setup
    def setup_db_settings(self):
        self.db_file_path = testdb.create_temp_db_file()
        MockedSettings['db_uri'] = testdb.get_temp_db_uri(self.db_file_path)
        with mock.patch.dict(db.Settings, MockedSettings):
            db.init_db()
            self.populate_database()

    @T.class_teardown
    def cleanup_database(self):

# Path: pushmanager/core/db.py
# def UnsignedInteger():
# def init_db():
# def finalize_db():
# def execute_cb(query, callback_fn):
# def execute_transaction_cb(queries, callback_fn, condition=None):
# def prefix_insert_ignore(insert_ignore, compiler, **kw):
# def prefix_insert_ignore_sqlite(insert_ignore, compiler, **kw):
# class DatabaseError(Exception):
# class PushCheckList(Base):
# class PushPlans(Base):
# class PushPushContents(Base):
# class PushPushes(Base):
# class PushRemovals(Base):
# class PushRequests(Base):
# class InsertIgnore(Insert):
# 
# Path: pushmanager/testing/mocksettings.py



# Path: pushmanager/tests/test_core_db.py
import os
import sqlalchemy as SA
import mock
import testify as T
from sqlalchemy.schema import Column
from sqlalchemy.schema import Table
from sqlalchemy.sql.compiler import SQLCompiler
from sqlalchemy.types import Integer
from pushmanager.core import db
from pushmanager.testing import testdb
from pushmanager.testing.mocksettings import MockedSettings
from pushmanager.testing.testdb import FakeDataMixin

#!/usr/bin/env python





class CoreDBTest(T.TestCase, FakeDataMixin):

    @T.class_setup
    def setup_db_settings(self):
        self.db_file_path = testdb.create_temp_db_file()
        MockedSettings['db_uri'] = testdb.get_temp_db_uri(self.db_file_path)
        with mock.patch.dict(db.Settings, MockedSettings):
            db.init_db()
            self.populate_database()

    @T.class_teardown
    def cleanup_database(self):

        db.finalize_db()