From a06d935ef4513cbd873131b1ef7b10e0f2e59bbb Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Mon, 19 Jan 2015 14:21:08 +0100 Subject: [PATCH] Drop tornado --- gns3server/main.py | 24 ------------------- old_tests/test_version_handler.py | 40 ------------------------------- 2 files changed, 64 deletions(-) delete mode 100644 old_tests/test_version_handler.py diff --git a/gns3server/main.py b/gns3server/main.py index 71aaae90..0f669c58 100644 --- a/gns3server/main.py +++ b/gns3server/main.py @@ -21,26 +21,12 @@ import datetime import sys import locale -#TODO: importing this module also configures logging options (colors etc.) -#see https://github.com/tornadoweb/tornado/blob/master/tornado/log.py#L208 -import tornado.options - from gns3server.server import Server from gns3server.version import __version__ import logging log = logging.getLogger(__name__) -#TODO: migrate command line options to argparse -# command line options -from tornado.options import define -define("host", default="0.0.0.0", help="run on the given host/IP address", type=str) -define("port", default=8000, help="run on the given port", type=int) -define("version", default=False, help="show the version", type=bool) -define("quiet", default=False, help="do not show output on stdout", type=bool) -define("console_bind_to_any", default=True, help="bind console ports to any local IP address", type=bool) - - def locale_check(): """ Checks if this application runs with a correct locale (i.e. supports UTF-8 encoding) and attempt to fix @@ -86,16 +72,6 @@ def main(): """ #TODO: migrate command line options to argparse (don't forget the quiet mode). - try: - tornado.options.parse_command_line() - except (tornado.options.Error, ValueError): - tornado.options.print_help() - raise SystemExit - - from tornado.options import options - if options.version: - print(__version__) - raise SystemExit current_year = datetime.date.today().year diff --git a/old_tests/test_version_handler.py b/old_tests/test_version_handler.py deleted file mode 100644 index 0c8c75d9..00000000 --- a/old_tests/test_version_handler.py +++ /dev/null @@ -1,40 +0,0 @@ -from tornado.testing import AsyncHTTPTestCase -from tornado.escape import json_decode -from gns3server.server import VersionHandler -from gns3server.version import __version__ -import tornado.web - -""" -Tests for the web server version handler -""" - - -class TestVersionHandler(AsyncHTTPTestCase): - - URL = "/version" - - def get_app(self): - - return tornado.web.Application([(self.URL, VersionHandler)]) - - def test_endpoint(self): - """ - Tests if the response HTTP code is 200 (success) - """ - - self.http_client.fetch(self.get_url(self.URL), self.stop) - response = self.wait() - assert response.code == 200 - - def test_received_version(self): - """ - Tests if the returned content type is JSON and - if the received version is the same as the server - """ - - self.http_client.fetch(self.get_url(self.URL), self.stop) - response = self.wait() - assert response.headers['Content-Type'].startswith('application/json') - assert response.body - body = json_decode(response.body) - assert body['version'] == __version__