mirror of
https://github.com/nesquena/hermes-webui.git
synced 2026-05-25 19:20:16 +00:00
19 lines
539 B
Python
19 lines
539 B
Python
import json
|
|
|
|
from server import Handler
|
|
|
|
|
|
def test_log_request_handles_malformed_request_without_path(capsys):
|
|
"""Malformed request lines can call log_request before path is assigned."""
|
|
handler = Handler.__new__(Handler)
|
|
handler.command = None
|
|
|
|
Handler.log_request(handler, "400")
|
|
|
|
line = capsys.readouterr().out.strip()
|
|
assert line.startswith("[webui] ")
|
|
record = json.loads(line.removeprefix("[webui] "))
|
|
assert record["method"] == "-"
|
|
assert record["path"] == "-"
|
|
assert record["status"] == 400
|