from setup import create_app app = create_app() app.app_context().push() if __name__ == '__main__': app.run(host='0.0.0.0', port=5000, debug=True)
import setup app = setup.create_app() if __name__ == '__main__': app.run(debug=True, host='0.0.0.0')
# all the imports import sqlite3 import json from datetime import datetime from flask import Flask, request, session, g, redirect, url_for, abort, render_template, flash from sqlalchemy.sql import func from setup import db, create_app from models import Version, GameStart, OSInfo, Uuid, MapStart, Map from handlers.gamestart import GamestartHandler from handlers.mapstart import MapstartHandler from itertools import groupby app = create_app(__name__) handler_mapping = { GamestartHandler.HANDLE: GamestartHandler, MapstartHandler.HANDLE: MapstartHandler } @app.route('/upload', methods=['POST']) def upload_data(): if request.json is not None: data = request.json assert isinstance(data, dict) if not 'uuid' in data: return uuid = Uuid.create_or_fetch(data['uuid']) for key, data in data.iteritems(): if key in handler_mapping: handler_mapping[key](data, uuid)
from setup import create_app, db from models.helper import model_classes application = create_app() # can test application with 'flask shell' @application.shell_context_processor def make_shell_context(): return dict({'db': db}, **model_classes) if __name__ == "__main__": # application.debug = True application.run()
def setUp(self): """Define test variables and initialize app.""" self.app = setup.create_app() self.client = self.app.test_client
def test_list_jobs(): app = create_app(testing=True) with app.test_client() as c: resp = c.get("/jobs") assert resp.status_code == 200
def test_get_pdf(): app = create_app(testing=True) with app.test_client() as c: resp = c.get("/pdf") assert resp.status_code == 200
def test_homepage(): app = create_app(testing=True) with app.test_client() as c: resp = c.get("/") assert resp.status_code == 200