tests: Improvements

This commit is contained in:
Lauri Võsandi 2017-05-01 22:41:41 +00:00
parent 58491e7933
commit a9c29d2fbb
3 changed files with 4 additions and 4 deletions

View File

@ -19,7 +19,7 @@ script:
- sudo useradd adminbot -G sudo -p '$1$PBkf5waA$n9EV6WJ7PS6lyGWkgeTPf1'
- sudo useradd userbot -G users -p '$1$PBkf5waA$n9EV6WJ7PS6lyGWkgeTPf1'
- sudo adduser --system --no-create-home --group certidude
- sudo py.test --cov-report xml --cov=certidude tests/
- sudo py.test -s -v --cov-report xml --cov=certidude tests/
cache:
directories:
- $HOME/.cache/pip

View File

@ -154,7 +154,6 @@ class StaticResource(object):
if os.path.isdir(path):
path = os.path.join(path, "index.html")
click.echo("Serving: %s" % path)
if os.path.exists(path):
content_type, content_encoding = mimetypes.guess_type(path)
@ -163,10 +162,11 @@ class StaticResource(object):
if content_encoding:
resp.append_header("Content-Encoding", content_encoding)
resp.stream = open(path, "rb")
logger.info("Serving '%s' from '%s'", req.path, path)
else:
resp.status = falcon.HTTP_404
resp.body = "File '%s' not found" % req.path
logger.info("Faile '%s' not found, path resolved to '%s'", req.path, path)
import ipaddress
class NormalizeMiddleware(object):

View File

@ -120,7 +120,7 @@ def test_cli_setup_authority():
r = client().simulate_get("/index.html")
assert r.status_code == 200, r.text
r = requests.get("http://ca.example.lan/index.html")
assert r.status_code == 200, r.text
assert r.status_code == 200, "server responded %s, logs say %s" % (r.text, open("/var/log/certidude.log").read())
# Test request submission