title: How can I test the functions in this Flask app- write unittests?
body: <pre><code>POOL = redis.ConnectionPool(host='localhost', port=6379, db=0)
  
  app = Flask(__name__)
  
  @app.route('/get_cohort_curve/', methods=['GET'])```
  def get_cohort_curve():
  
      curve = str(request.args.get('curve'))
      cohort = str(request.args.get('cohort'))
  
      key = curve+cohort
      return get_from_redis(key)
  
  def get_from_redis(key):
      try:
          my_server = redis.Redis(connection_pool=POOL)
          return json.dumps(my_server.get(key))
      except Exception, e:
          logging.error(e)
  
  app.run()
  </code></pre>
  
  <p>I need to write unit-tests for this. </p>
  
  <p>How do I test just the route, i.e. a get request goes to the right place?</p>
  
  <p>Do I need to create and destroy instances of the app in the test for each function? </p>
  
  <p>Do I need to create a mock redis connection?</p>