autoland: hook for test suite to construct a tornado app object (bug 1337501) r?smacleod draft
authorMāris Fogels <mars@mozilla.com>
Tue, 07 Feb 2017 15:56:09 -0500
changeset 110 3ccb9b0e9b58aeb0b0b8cb492fb0b91b10b48555
parent 109 110321f0ae456b5ab318cef342ae02f66ab30b91
child 111 1c98ec58e46ec3f67186b9ef181de0b2ae2ffe23
child 112 fd951d778cde51fe671441cc42daaeab20fab092
push id68
push usermfogels@mozilla.com
push dateWed, 08 Feb 2017 21:45:22 +0000
reviewerssmacleod
bugs1337501
autoland: hook for test suite to construct a tornado app object (bug 1337501) r?smacleod Create a hook that the test suite can use to construct a Tornado Application object. MozReview-Commit-ID: 6UrSizOwg93
autoland/public-web-api/autolandweb/server.py
--- a/autoland/public-web-api/autolandweb/server.py
+++ b/autoland/public-web-api/autolandweb/server.py
@@ -7,23 +7,28 @@ import click
 import tornado.ioloop
 import tornado.log
 import tornado.web
 
 from autolandweb.mozlog import LOGGING_CONFIG, tornado_log_function
 from autolandweb.routes import ROUTES
 
 
+def make_app(debug):
+    """Construct a fully configured Tornado Application object."""
+    return tornado.web.Application(
+        ROUTES,
+        debug=debug,
+        log_function=tornado_log_function)
+
+
 @click.command()
 @click.option('--debug', envvar='AUTOLANDWEB_DEBUG', is_flag=True)
 @click.option('--port', envvar='AUTOLANDWEB_PORT', default=8888)
 def autolandweb(debug, port):
     logging.config.dictConfig(LOGGING_CONFIG)
-
-    app = tornado.web.Application(
-        ROUTES, debug=debug, log_function=tornado_log_function
-    )
+    app = make_app(debug)
     app.listen(port)
     tornado.ioloop.IOLoop.current().start()
 
 
 if __name__ == '__main__':
     autolandweb()