mirror of
https://git.quad4.io/RNS-Things/MeshChatX.git
synced 2026-04-03 12:05:41 +00:00
25 lines
694 B
Python
25 lines
694 B
Python
"""CLI validation for custom TLS certificate paths."""
|
|
|
|
import sys
|
|
from unittest.mock import patch
|
|
|
|
import pytest
|
|
|
|
import meshchatx.meshchat as meshchat_module
|
|
|
|
|
|
def test_ssl_cert_without_key_exits():
|
|
argv = ["meshchat", "--ssl-cert", "/tmp/custom-cert.pem"]
|
|
with patch.object(sys, "argv", argv):
|
|
with pytest.raises(SystemExit) as exc_info:
|
|
meshchat_module.main()
|
|
assert exc_info.value.code == 2
|
|
|
|
|
|
def test_ssl_key_without_cert_exits():
|
|
argv = ["meshchat", "--ssl-key", "/tmp/custom-key.pem"]
|
|
with patch.object(sys, "argv", argv):
|
|
with pytest.raises(SystemExit) as exc_info:
|
|
meshchat_module.main()
|
|
assert exc_info.value.code == 2
|