Пример #1
0
def configure_db():
    """Configure database.

    Establish the database, create an engine if needed, and register
    the models.
    """
    global _DB_ENGINE
    if not _DB_ENGINE:
        session.set_defaults('sqlite:////tmp/savanna-server.db',
                             'savanna-server.db')
        _DB_ENGINE = session.get_engine(sqlite_fk=True)
        register_models()
Пример #2
0
 def setUp(self):
     self.maxDiff = None
     self.set_tenant()
     self.db_fd, self.db_path = tempfile.mkstemp()
     session.set_defaults('sqlite:///' + self.db_path, self.db_path)
     db_api.setup_db()
Пример #3
0
 def setUp(self):
     self.set_tenant()
     self.db_fd, self.db_path = tempfile.mkstemp()
     session.set_defaults('sqlite:///' + self.db_path, self.db_path)
     db_api.configure_db()
Пример #4
0
 def setUp(self):
     self.maxDiff = None
     self.set_tenant()
     self.db_fd, self.db_path = tempfile.mkstemp()
     session.set_defaults('sqlite:///' + self.db_path, self.db_path)
     db_api.setup_db()
Пример #5
0
 def setup_db(self):
     self.db_fd, self.db_path = tempfile.mkstemp()
     session.set_defaults('sqlite:///' + self.db_path, self.db_path)
     db_api.setup_db()
     self.addCleanup(self._drop_db)