title: Integration testing Flask on Google App Engine
body: <p>I have written a Flask Application and hosted it on Google App Engine. </p>
  
  <p>How do I run integration tests in Flask similar to the handler testing mentioned in this <a href="https://cloud.google.com/appengine/docs/python/tools/handlertesting" rel="nofollow">article</a>. </p>
  
  <p>Essentially I want to verify that a list of pages (located in the blueprints) loads with a 200 response code, before I deploy the app to Google App Engine. </p>
  
  <p>my main.py looks like</p>
  
  <pre><code>""" main.py is the top level script.
  
  Return Index.html at the root. 
  """
  
  import gdata.youtube
  import gdata.youtube.service
  import random
  import string
  import logging
  
  import sys
  import json
  
  from google.appengine.ext import ereporter
  
  ereporter.register_logger()
  reload(sys)
  sys.setdefaultencoding("utf-8")
  
  # sys.path includes 'server/lib' due to appengine_config.py
  from flask import Flask
  from flask import render_template, request, session, abort
  from Routes.BelieveRoutes import believe_routes
  from Routes.SermonRoutes import sermon_routes
  from Routes.ErrorRoutes import error_routes
  from Routes.HomeRoutes import home_routes
  from Routes.BookRoutes import book_routes
  from Routes.ArticlesRoutes import articles_routes
  from Routes.SearchRoutes import search_routes
  from Routes.EndPointRoutes import endpoint_routes
  from Routes.TestRoutes import test_routes
  from Routes.ConferenceRoutes import conference_routes
  
  
  app = Flask(__name__.split('.')[0])
  
  
  app.register_blueprint(believe_routes)
  app.register_blueprint(sermon_routes)
  app.register_blueprint(error_routes)
  app.register_blueprint(home_routes)
  app.register_blueprint(book_routes)
  app.register_blueprint(articles_routes)
  app.register_blueprint(search_routes)
  app.register_blueprint(endpoint_routes)
  app.register_blueprint(test_routes)
  app.register_blueprint(conference_routes)
  
  
  @app.route('/')
  @app.route('/index')
  def index():
      return render_template('index.html')
  
  
  @app.errorhandler(500)
  def internal_server_error(e):
      return render_template('errorpages/500.html'), 500
  </code></pre>