From 19e6d956dfcbc3de605736a90ece8fd29bd843cd Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Mon, 29 Aug 2016 14:22:55 +0200 Subject: [PATCH] Drop unused endpoint POST /version on compute --- .../handlers/api/compute/version_handler.py | 14 ---------- tests/handlers/api/compute/test_version.py | 27 ------------------- 2 files changed, 41 deletions(-) diff --git a/gns3server/handlers/api/compute/version_handler.py b/gns3server/handlers/api/compute/version_handler.py index b45f4aa9..69ee1f17 100644 --- a/gns3server/handlers/api/compute/version_handler.py +++ b/gns3server/handlers/api/compute/version_handler.py @@ -33,17 +33,3 @@ class VersionHandler: config = Config.instance() local_server = config.get_section_config("Server").getboolean("local", False) response.json({"version": __version__, "local": local_server}) - - @Route.post( - r"/version", - description="Check if version is the same as the server", - output=VERSION_SCHEMA, - input=VERSION_SCHEMA, - status_codes={ - 200: "Same version", - 409: "Invalid version" - }) - def check_version(request, response): - if request.json["version"] != __version__: - raise HTTPConflict(text="Client version {} differs with server version {}".format(request.json["version"], __version__)) - response.json({"version": __version__}) diff --git a/tests/handlers/api/compute/test_version.py b/tests/handlers/api/compute/test_version.py index da42188e..09e29682 100644 --- a/tests/handlers/api/compute/test_version.py +++ b/tests/handlers/api/compute/test_version.py @@ -32,30 +32,3 @@ def test_version_output(http_compute): response = http_compute.get('/version', example=True) assert response.status == 200 assert response.json == {'local': True, 'version': __version__} - - -def test_version_input(http_compute): - query = {'version': __version__} - response = http_compute.post('/version', query, example=True) - assert response.status == 200 - assert response.json == {'version': __version__} - - -def test_version_invalid_input(http_compute): - query = {'version': "0.4.2"} - response = http_compute.post('/version', query) - assert response.status == 409 - assert response.json == {'message': 'Client version 0.4.2 differs with server version {}'.format(__version__), - 'status': 409} - - -def test_version_invalid_input_schema(http_compute): - query = {'version': "0.4.2", "bla": "blu"} - response = http_compute.post('/version', query) - assert response.status == 400 - - -def test_version_invalid_json(http_compute): - query = "BOUM" - response = http_compute.post('/version', query, raw=True) - assert response.status == 400