mirror of
https://github.com/laurivosandi/certidude
synced 2024-12-22 16:25:17 +00:00
tests: Improvements
This commit is contained in:
parent
58491e7933
commit
a9c29d2fbb
@ -19,7 +19,7 @@ script:
|
|||||||
- sudo useradd adminbot -G sudo -p '$1$PBkf5waA$n9EV6WJ7PS6lyGWkgeTPf1'
|
- sudo useradd adminbot -G sudo -p '$1$PBkf5waA$n9EV6WJ7PS6lyGWkgeTPf1'
|
||||||
- sudo useradd userbot -G users -p '$1$PBkf5waA$n9EV6WJ7PS6lyGWkgeTPf1'
|
- sudo useradd userbot -G users -p '$1$PBkf5waA$n9EV6WJ7PS6lyGWkgeTPf1'
|
||||||
- sudo adduser --system --no-create-home --group certidude
|
- 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:
|
cache:
|
||||||
directories:
|
directories:
|
||||||
- $HOME/.cache/pip
|
- $HOME/.cache/pip
|
||||||
|
@ -154,7 +154,6 @@ class StaticResource(object):
|
|||||||
|
|
||||||
if os.path.isdir(path):
|
if os.path.isdir(path):
|
||||||
path = os.path.join(path, "index.html")
|
path = os.path.join(path, "index.html")
|
||||||
click.echo("Serving: %s" % path)
|
|
||||||
|
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
content_type, content_encoding = mimetypes.guess_type(path)
|
content_type, content_encoding = mimetypes.guess_type(path)
|
||||||
@ -163,10 +162,11 @@ class StaticResource(object):
|
|||||||
if content_encoding:
|
if content_encoding:
|
||||||
resp.append_header("Content-Encoding", content_encoding)
|
resp.append_header("Content-Encoding", content_encoding)
|
||||||
resp.stream = open(path, "rb")
|
resp.stream = open(path, "rb")
|
||||||
|
logger.info("Serving '%s' from '%s'", req.path, path)
|
||||||
else:
|
else:
|
||||||
resp.status = falcon.HTTP_404
|
resp.status = falcon.HTTP_404
|
||||||
resp.body = "File '%s' not found" % req.path
|
resp.body = "File '%s' not found" % req.path
|
||||||
|
logger.info("Faile '%s' not found, path resolved to '%s'", req.path, path)
|
||||||
import ipaddress
|
import ipaddress
|
||||||
|
|
||||||
class NormalizeMiddleware(object):
|
class NormalizeMiddleware(object):
|
||||||
|
@ -120,7 +120,7 @@ def test_cli_setup_authority():
|
|||||||
r = client().simulate_get("/index.html")
|
r = client().simulate_get("/index.html")
|
||||||
assert r.status_code == 200, r.text
|
assert r.status_code == 200, r.text
|
||||||
r = requests.get("http://ca.example.lan/index.html")
|
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
|
# Test request submission
|
||||||
|
Loading…
Reference in New Issue
Block a user