mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-11-20 04:23:01 +03:00
CI / AMD64 Build (push) Canceled after 0s
CI / AMD64 Smoke Test (push) Canceled after 0s
CI / ARM Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s
* Validate MQTT TLS verification options before client startup * Test MQTT configuration recovery with authentication available * Cover both MQTT TLS verification values in safe-mode recovery * Use a documentation address in MQTT regression tests * Skip MQTT TLS validation when MQTT is disabled * Simplify MQTT TLS validation regression coverage --------- Co-authored-by: Peter Kay <dougle.peter.kay@googlemail.com>
25 lines
879 B
Python
25 lines
879 B
Python
"""Tests for MQTT TLS configuration validation."""
|
|
|
|
import unittest
|
|
from contextlib import nullcontext
|
|
|
|
from pydantic import ValidationError
|
|
|
|
from frigate.config import MqttConfig
|
|
|
|
|
|
class TestMqttTls(unittest.TestCase):
|
|
def test_tls_insecure_requires_tls_only_when_enabled(self) -> None:
|
|
"""Require TLS for either explicit verification flag only if MQTT is enabled."""
|
|
for enabled in (True, False):
|
|
for insecure in (True, False):
|
|
expected = (
|
|
self.assertRaisesRegex(
|
|
ValidationError, "tls_insecure requires tls_ca_certs"
|
|
)
|
|
if enabled
|
|
else nullcontext()
|
|
)
|
|
with self.subTest(enabled=enabled, tls_insecure=insecure), expected:
|
|
MqttConfig(enabled=enabled, tls_insecure=insecure)
|