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
--- 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()