def create_test_app(path, func, **options): """ create a test app that wraps a func at the path specified, and returns a test client to of the flask app """ app = Flask(__name__) route_set = FlaskRouteSet() route_set.route_function(path, func) route_set.init_app(app) return app.test_client()
def app(): """ a fixture that provides a basic test route. """ app = Flask(__name__) route_set = FlaskRouteSet() @route_set.route("/test") @flask_transmute.annotate({"arg1": str, "arg2": bool, "return": float}) def test(arg1, arg2): return 1.0 @route_set.route("/test_post") @flask_transmute.updates def test_post(arg1, arg2): return 2.0 route_set.init_app(app) return app.test_client()
def create_test_app(path, func, **options): """ create a test app that wraps a func at the path specified, and returns a test client to of the flask app """ app = Flask(__name__) app.debug = True route_set = FlaskRouteSet() route_set.route_function(path, func) route_set.init_app(app) return app.test_client()
) self._cards += [card] return card @flask_transmute.annotate({"return": [Card]}) def cards(self): """ retrieve all cards from the deck """ return self._cards def reset(self): self._cards = [] app = Flask(__name__) deck = Deck() route_set = FlaskRouteSet() route_set.route_object('/deck', deck, # if exceptions are added to error_exceptions, # they will be caught and raise a success: false # response, with the error message being the message # of the exception error_exceptions=[DeckException]) def raise_401(): raise ApiException("", status_code=401) route_set.route_function("/raise_401", raise_401) def raise_404():