forked from github.com/pypiserver
feat: add extremely basic /health endpoint (#396)
* Add extremely basic /health endpoint * Replace robot-sounds with Ok. * add test case for /health endpoint * Apply suggestion to _app.py: - remove dot from Ok response in health endpoint * Fix tests for the health endpoint * Formatting _app.py
This commit is contained in:
parent
640a74872b
commit
61e44871d4
@ -82,6 +82,11 @@ def log_error(http_error):
|
||||
log.info(config.log_err_frmt, vars(http_error))
|
||||
|
||||
|
||||
@app.route("/health")
|
||||
def health():
|
||||
return "Ok"
|
||||
|
||||
|
||||
@app.route("/favicon.ico")
|
||||
def favicon():
|
||||
return HTTPError(404)
|
||||
|
@ -188,6 +188,12 @@ def test_packages_empty(testapp):
|
||||
assert len(resp.html("a")) == 0
|
||||
|
||||
|
||||
def test_health(testapp):
|
||||
resp = testapp.get("/health")
|
||||
assert resp.status_int == 200
|
||||
assert "Ok" in resp
|
||||
|
||||
|
||||
def test_favicon(testapp):
|
||||
testapp.get("/favicon.ico", status=404)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user