Fix vt.Terminal failing test: test_log_sanitize

Fixes failing test added in a09b4f4450

We can't assume tests are run at debug level, so this ensures the test
passes regardless of what logging level is currently set by capturing
the output in caplog at DEBUG which stream_stdout/stream_stderr uses by
default.

Signed-off-by: Joe Groocock <jgroocock@cloudflare.com>
This commit is contained in:
Joe Groocock 2023-09-18 12:29:22 +01:00 committed by Pedro Algarvio
parent 2fb207753e
commit 238a744bcb

View file

@ -1,3 +1,4 @@
import logging
import os
import signal
@ -43,10 +44,13 @@ def test_log_sanitize(test_cmd, caplog):
cmd,
log_stdout=True,
log_stderr=True,
log_stdout_level="debug",
log_stderr_level="debug",
log_sanitize=password,
stream_stdout=False,
stream_stderr=False,
)
ret = term.recv()
with caplog.at_level(logging.DEBUG):
ret = term.recv()
assert password not in caplog.text
assert "******" in caplog.text