Skip to content
Snippets Groups Projects
Commit 949fb7c2 authored by Daniel's avatar Daniel
Browse files

MAINT: Formatting of test_webinterface.py

parent 7a525917
Branches
Tags
No related merge requests found
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment