mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-10-02 21:06:52 +03:00
Various Tweaks (#22609)
CI / AMD64 Build (push) Waiting to run
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
CI / AMD64 Build (push) Waiting to run
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
* Mark items as reviewed as a group with keyboard * Improve handling of half model regions * update viewport meta tag to prevent user scaling fixes https://github.com/blakeblackshear/frigate/issues/22017 * add small animation to collapsible shadcn elements * add proxy auth env var tests * Improve search effect * Fix mobile back navigation losing overlay state on classification page * undo historyBack changes * fix classification history navigation --------- Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>
This commit is contained in:
co-authored by
Josh Hawkins
parent
334245bd3c
commit
4b42039568
@@ -2,6 +2,7 @@ import unittest
|
||||
|
||||
from frigate.api.auth import resolve_role
|
||||
from frigate.config import HeaderMappingConfig, ProxyConfig
|
||||
from frigate.config.env import FRIGATE_ENV_VARS
|
||||
|
||||
|
||||
class TestProxyRoleResolution(unittest.TestCase):
|
||||
@@ -91,3 +92,39 @@ class TestProxyRoleResolution(unittest.TestCase):
|
||||
headers = {"x-remote-role": "group_unknown"}
|
||||
role = resolve_role(headers, self.proxy_config, self.config_roles)
|
||||
self.assertEqual(role, self.proxy_config.default_role)
|
||||
|
||||
|
||||
class TestProxyAuthSecretEnvString(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self._original_env_vars = dict(FRIGATE_ENV_VARS)
|
||||
|
||||
def tearDown(self):
|
||||
FRIGATE_ENV_VARS.clear()
|
||||
FRIGATE_ENV_VARS.update(self._original_env_vars)
|
||||
|
||||
def test_auth_secret_env_substitution(self):
|
||||
"""auth_secret resolves FRIGATE_ env vars via EnvString."""
|
||||
FRIGATE_ENV_VARS["FRIGATE_PROXY_SECRET"] = "my_secret_value"
|
||||
config = ProxyConfig(auth_secret="{FRIGATE_PROXY_SECRET}")
|
||||
self.assertEqual(config.auth_secret, "my_secret_value")
|
||||
|
||||
def test_auth_secret_env_embedded_in_string(self):
|
||||
"""auth_secret resolves env vars embedded in a larger string."""
|
||||
FRIGATE_ENV_VARS["FRIGATE_SECRET_PART"] = "abc123"
|
||||
config = ProxyConfig(auth_secret="prefix-{FRIGATE_SECRET_PART}-suffix")
|
||||
self.assertEqual(config.auth_secret, "prefix-abc123-suffix")
|
||||
|
||||
def test_auth_secret_plain_string(self):
|
||||
"""auth_secret accepts a plain string without substitution."""
|
||||
config = ProxyConfig(auth_secret="literal_secret")
|
||||
self.assertEqual(config.auth_secret, "literal_secret")
|
||||
|
||||
def test_auth_secret_none(self):
|
||||
"""auth_secret defaults to None."""
|
||||
config = ProxyConfig()
|
||||
self.assertIsNone(config.auth_secret)
|
||||
|
||||
def test_auth_secret_unknown_var_raises(self):
|
||||
"""auth_secret raises KeyError for unknown env var references."""
|
||||
with self.assertRaises(Exception):
|
||||
ProxyConfig(auth_secret="{FRIGATE_NONEXISTENT_VAR}")
|
||||
|
||||
Reference in New Issue
Block a user