From 949fb7c21634d457363e03a1088b9fda9c586405 Mon Sep 17 00:00:00 2001 From: Daniel <daniel@harvey> Date: Mon, 25 Nov 2019 15:01:29 +0100 Subject: [PATCH] MAINT: Formatting of test_webinterface.py --- tests/test_webinterface.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/tests/test_webinterface.py b/tests/test_webinterface.py index c4f622c..b9ba13f 100644 --- a/tests/test_webinterface.py +++ b/tests/test_webinterface.py @@ -5,6 +5,7 @@ # # Copyright (C) 2019 Timm Fitschen (t.fitschen@indiscale.com) # Copyright (C) 2019 IndiScale GmbH +# Copyright (C) 2019 Daniel Hornung (d.hornung@indiscale.com) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -25,35 +26,33 @@ @author: Timm Fitschen (t.fitschen@indiscale.com) """ -import caosdb as c from urllib import request from urllib.error import HTTPError import ssl import re +import caosdb as c import pytest + def test_webinterface_version_build(): + """Tests if a correct build number is created and returned.""" url = c.get_config().get("Connection", "url") context = ssl.SSLContext() context.verify_mode = ssl.CERT_NONE - buildNumber = request.urlopen(url + "webinterface/version/build", - context=context).read().decode("utf8") - assert re.match(r"\d+", buildNumber) + build_number = request.urlopen(url + "webinterface/version/build", + context=context).read().decode("utf8") + assert re.match(r"\d+", build_number) + def test_webinterface(): + """Tests if a 404 error is correctly returned.""" url = c.get_config().get("Connection", "url") context = ssl.SSLContext() context.verify_mode = ssl.CERT_NONE - buildNumber = request.urlopen(url + "webinterface/version/build", - context=context).read().decode("utf8") - with pytest.raises(HTTPError) as e404: request.urlopen(url + "webinterface/..", context=context) assert e404.value.code == 404 - - - -- GitLab