Esempio n. 1
0
    def setUp(self):
        """
        Set up for testing
        swift.common.key_manager.drivers.sql.SQLDriver.
        """
        self.db_path = tempfile.mktemp()
        self.url = "sqlite:///%s" % (self.db_path, )
        self.conf = {'crypto_keystore_sql_url': self.url}
        self.key_driver = SQLDriver(self.conf)
        self.execute = mock.Mock()
        self.mock_conn = mock.Mock(OperationalError=exc.OperationalError)

        self.mock_conn.cursor.return_value = mock.Mock(execute=self.execute)
        engine = create_engine(self.url)
        meta_test.bind = engine
        Session.configure(bind=engine)
        table_template.create(engine, checkfirst=True)