示例#1
0
def init_db():
    """
    Creates tables by SQLAlchemy models
    """
    settings = get_normalized_settings()
    engine = get_db_engine(settings)
    Base.metadata.create_all(bind=engine)

    db = get_db_session(settings)
    factory = ServerInstancesFactory(db)
    factory.gen_servers()
 def setUp(self):
     super(ServerHandlersAPITestCase, self).setUp()
     factory = ServerInstancesFactory(self._app.db)
     self.test_server = factory.new_server()
     self._app.db.add(self.test_server)
     self._app.db.commit()