コード例 #1
0
    def setUp(self):
        from .test_storage import PostgresqlStorageTest

        self.settings = PostgresqlStorageTest.settings.copy()
        self.config = mock.Mock(get_settings=mock.Mock(
            return_value=self.settings))

        self.version = postgresql.PostgreSQL.schema_version

        # Usual storage object to manipulate the storage.
        self.storage = postgresql.load_from_config(self.config)

        # Start empty.
        self._delete_everything()

        # Create schema in its last version
        self.storage = postgresql.load_from_config(self.config)
        self.storage.initialize_schema()

        # Patch to keep track of SQL files executed.
        self.sql_execute_patcher = mock.patch(
            'cliquet.storage.postgresql.PostgreSQL._execute_sql_file')
コード例 #2
0
    def __init__(self, *args, **kwargs):
        super(PostgresqlStorageMigrationTest, self).__init__(*args, **kwargs)
        from cliquet.utils import sqlalchemy
        if sqlalchemy is None:
            return

        from .test_storage import PostgreSQLStorageTest
        self.settings = PostgreSQLStorageTest.settings.copy()
        self.config = testing.setUp()
        self.config.add_settings(self.settings)
        self.version = postgresql.Storage.schema_version
        # Usual storage object to manipulate the storage.
        self.storage = postgresql.load_from_config(self.config)