def app_and_ctx(): warnings.filterwarnings("ignore", category=SADeprecationWarning) app = create_app(os.getenv('TESTING_ENV', "testing")) ctx = app.app_context() ctx.push() yield app, ctx db.drop_all()
def setup_user_device_public_key(request): device_id, user_id, pk, db_name = request.param warnings.filterwarnings("ignore", category=SADeprecationWarning) app = create_app(os.getenv('TESTING_ENV', "testing")) with app.app_context(): _swap_db(app, "testing", db_name) _set_user_device_public_key(device_id, user_id, pk) _swap_db(app, db_name, "testing") yield None with app.app_context(): _swap_db(app, "testing", db_name) _set_user_device_public_key(device_id, user_id, None) _swap_db(app, db_name, "testing")
return start + timedelta(seconds=random_second) def create_abe_key_pair(): pairing_group = create_pairing_group() cp_abe = create_cp_abe() public_key, master_key = cp_abe.setup() serialized_public_key = serialize_charm_object(public_key, pairing_group) serialized_master_key = serialize_charm_object(master_key, pairing_group) return serialized_public_key, serialized_master_key app = create_app(DB_SETUP_CONFIG_NAME) app.app_context().push() attr_auth_engine = db.get_engine(app, 'attr_auth') seqs = db.engine.execute( "SELECT sequence_name FROM information_schema.sequences").fetchall() seq_names = [row[0] for row in seqs] for s in seq_names: db.engine.execute(f"ALTER SEQUENCE {s} RESTART WITH 100;") seqs = attr_auth_engine.execute( "SELECT sequence_name FROM information_schema.sequences").fetchall() seq_names = [row[0] for row in seqs]
def application(): warnings.filterwarnings("ignore", category=SADeprecationWarning) app = create_app(os.getenv('TESTING_ENV', "testing")) yield app db.drop_all()
def client(): warnings.filterwarnings("ignore", category=SADeprecationWarning) app = create_app(os.getenv('TESTING_ENV', "testing")) return app.test_client()
import os from app.app_setup import create_app app = create_app(os.environ.get('FLASK_ENV')) if __name__ == "__main__": # Only for debugging while developing app.run(host='0.0.0.0', debug=True, use_reloader=False, port=5000)