test: code quality fixes — docstring count, ruff format, test name accuracy
- Update test_tls.py module docstring: '9 tests' → '12 tests' (stale after edge case additions) - Parenthesize assertion message on line 177 of test_tls.py (ruff line-length format) - Rename test_serve_warns_when_only_cert_set → test_serve_no_ssl_when_only_cert_set to accurately reflect test behavior (verifies no SSL, not that a warning is printed)
This commit is contained in:
@@ -1641,7 +1641,7 @@ def test_doctor_shows_tls_clipboard_warning(tmp_path, monkeypatch, capsys):
|
|||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
def test_serve_warns_when_only_cert_set(tmp_path, monkeypatch, capsys):
|
def test_serve_no_ssl_when_only_cert_set(tmp_path, monkeypatch, capsys):
|
||||||
"""serve() must NOT enable SSL when tls_cert is set but tls_key is empty string."""
|
"""serve() must NOT enable SSL when tls_cert is set but tls_key is empty string."""
|
||||||
import muxplex.cli as cli_mod
|
import muxplex.cli as cli_mod
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"""
|
"""
|
||||||
Tests for muxplex/tls.py — TLS certificate generation and inspection.
|
Tests for muxplex/tls.py — TLS certificate generation and inspection.
|
||||||
9 tests covering generate_self_signed() and get_cert_info().
|
12 tests covering generate_self_signed() and get_cert_info().
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import stat
|
import stat
|
||||||
@@ -174,7 +174,9 @@ def test_generate_self_signed_with_custom_hostnames(tmp_path):
|
|||||||
result = generate_self_signed(cert_path, key_path, hostnames=custom_hostnames)
|
result = generate_self_signed(cert_path, key_path, hostnames=custom_hostnames)
|
||||||
|
|
||||||
assert isinstance(result, dict), "generate_self_signed() must return a dict"
|
assert isinstance(result, dict), "generate_self_signed() must return a dict"
|
||||||
assert isinstance(result.get("hostnames"), list), "result['hostnames'] must be a list"
|
assert isinstance(result.get("hostnames"), list), (
|
||||||
|
"result['hostnames'] must be a list"
|
||||||
|
)
|
||||||
assert "mybox.local" in result["hostnames"], (
|
assert "mybox.local" in result["hostnames"], (
|
||||||
f"'mybox.local' must be in result['hostnames'], got: {result['hostnames']!r}"
|
f"'mybox.local' must be in result['hostnames'], got: {result['hostnames']!r}"
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user