def setUp(self): logger.info("setUp") self.app = make_app() self.app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite://" self._ctx = self.app.test_request_context() self._ctx.push() db.init_app(self.app) db.create_all() logger.info("setUp done")
def setUp(self): logger.info("setUp") self.app = make_app() door.doors["test-door-1"] = door.MqttDoor("test-door-1", 1, {"door"}, "test-door-1/open") door.doors["test-door-2"] = door.MqttDoor("test-door-2", 1, {"bv9-chemist"}, "test-door-2/open") door.doors["test-door-3"] = door.MqttDoor("test-door-3", 1, {"other-circle"}, "test-door-3/open") self.app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite://" self._ctx = self.app.test_request_context() self._ctx.push() db.init_app(self.app) db.create_all() logger.info("setUp done")
l = logging.getLogger("p2k16") [l.removeHandler(h) for h in l.handlers] l.addHandler(handler) l.setLevel(logging.DEBUG) l = logging.getLogger("sqlalchemy.engine.base.Engine") [l.removeHandler(h) for h in l.handlers] l.addHandler(handler) l = logging.getLogger("paho.mqtt") l.setLevel(logging.DEBUG) [l.removeHandler(h) for h in l.handlers] l.addHandler(handler) app = make_app() configure_logging() @app.url_defaults def hashed_url_for_static_file(endpoint, values): def create_hash(path): t = flask.current_app.config.get("RESOURCE_HASH_TYPE", None) if t == "mtime": return int(os.stat(path).st_mtime) # print("hashed_url_for_static_file: endpoint={}, values={}".format(endpoint, values)) if 'static' == endpoint or endpoint.endswith('.static'): filename = values.get('filename')
def create_app(self): app = make_app() db.init_app(app) return app