Refresh snapshots after light actions
This commit is contained in:
+20
-1
@@ -1,6 +1,6 @@
|
||||
import unittest
|
||||
|
||||
from frigate_camera_control_bridge.ui import render_page
|
||||
from frigate_camera_control_bridge.ui import camera_stream_url, render_page
|
||||
|
||||
|
||||
class DummyAction:
|
||||
@@ -11,6 +11,7 @@ class DummyAction:
|
||||
self.state = state
|
||||
self.auto_off_seconds = 180
|
||||
self.auto_off_at = 1234567890
|
||||
self.snapshot_version = 42
|
||||
self.cfg = {
|
||||
"name_key": name_key,
|
||||
"camera_name": "Example camera",
|
||||
@@ -35,6 +36,7 @@ class UiRenderTest(unittest.TestCase):
|
||||
self.assertIn('data-auto-off-at="1234567890"', html)
|
||||
self.assertIn('data-requires-ack="true"', html)
|
||||
self.assertIn("Example camera", html)
|
||||
self.assertIn("v=42", html)
|
||||
|
||||
def test_controls_from_same_camera_share_one_card(self):
|
||||
actions = [
|
||||
@@ -73,6 +75,23 @@ class UiRenderTest(unittest.TestCase):
|
||||
self.assertIn('data-working-label="Refreshing cameras..."', html)
|
||||
self.assertIn("<svg", html)
|
||||
|
||||
def test_camera_stream_link_uses_default_frigate_url(self):
|
||||
action = DummyAction()
|
||||
|
||||
self.assertEqual(
|
||||
camera_stream_url(action),
|
||||
"http://frigate.example.test:5000/#example",
|
||||
)
|
||||
|
||||
def test_camera_stream_link_uses_public_proxy_url_from_env_config(self):
|
||||
action = DummyAction()
|
||||
action.cfg["snapshot"]["public_url"] = "https://frigate.example.test"
|
||||
|
||||
self.assertEqual(
|
||||
camera_stream_url(action),
|
||||
"https://frigate.example.test/#example",
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user