1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-19 14:58:07 +00:00

Drop unused endpoint POST /version on compute

This commit is contained in:
Julien Duponchelle 2016-08-29 14:22:55 +02:00
parent 72fe5d3489
commit 19e6d956df
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8
2 changed files with 0 additions and 41 deletions

View File

@ -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__})

View File

@ -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