def create_app(): # init API app = Flask(__name__) app.config['CORS_HEADERS'] = 'Content-Type' api = Api(app) cors = CORS(app, resources={r"/*": { "origins": "*" }}, supports_credentials=True) # init Database init_db() # add resources api.add_resource(ConfigurationListAPI, '/configurations', endpoint='configs') api.add_resource(ConfigurationAPI, '/configurations/<int:config_ID>', endpoint='config') api.add_resource(ConfigurationByFeedAPI, '/configurations/feed/<int:feed_ID>', endpoint='configfeed') api.add_resource(VideoFeedListAPI, '/feeds', endpoint='feeds') api.add_resource(VideoFeedAPI, '/feeds/<int:feed_ID>', endpoint='feed') api.add_resource(VideoFeedStreamAPI, '/feeds/start/<int:feed_ID>', endpoint='start_feed') @app.teardown_appcontext def shutdown_session(exception=None): db_session.remove() return app
def testMainWithDropFlag(self, metadata): init_db.init_db(self.engine) metadata.create_all.assert_called_once_with(self.engine) metadata.drop_all.assert_called_once_with(self.engine)
def testMainNoDropFlag(self): init_db.init_db(self.engine) self.assertCountEqual(self.engine.table_names(), ['metric_results', 'travis_builds'])
def init_db(self): self.set_db_path() init_db(self.info.dbpath)
def setUpClass(cls): super(TestBuild, cls).setUpClass() engine = sqlalchemy.create_engine('sqlite:///:memory:', echo=True) init_db.init_db(engine) cls.Session = orm.scoped_session(orm.sessionmaker(bind=engine))