#NEWLINE# @ pytest . fixture ( scope = 'function' ) #NEWLINE# def routeapp( request , testapp ) : #NEWLINE# #INDENT# 'Returns Flask app with established app context and registered routes.' #NEWLINE# ( url , url2 , url3 , url4 ) = ( '/lorem' , '/life' , '/world' , '/echo' ) #NEWLINE# testapp . routes = [ url , url2 , url3 , url4 ] #NEWLINE# @ testapp . route ( url , methods = [ 'GET' ] ) #NEWLINE# def lorem( ) : #NEWLINE# #INDENT# return jsonify ( title = 'lorem ipsum' , body = 'lorem ipsum dolor sit amet...' ) #NEWLINE# #UNINDENT# @ testapp . route ( url2 , methods = [ 'GET' ] ) #NEWLINE# def life( ) : #NEWLINE# #INDENT# return jsonify ( title = 'about life' , body = 'life is beautiful' ) #NEWLINE# #UNINDENT# @ testapp . route ( url3 , methods = [ 'GET' ] ) #NEWLINE# def world( ) : #NEWLINE# #INDENT# return jsonify ( title = 'hello' , body = 'world' ) #NEWLINE# #UNINDENT# @ testapp . route ( url4 , methods = [ 'POST' ] ) #NEWLINE# def echo( ) : #NEWLINE# #INDENT# from flask import request #NEWLINE# return jsonify ( echo = request . data . decode ( 'utf8' ) ) #NEWLINE# #UNINDENT# return url