mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-03 09:45:22 +03:00
Mock requests
This commit is contained in:
parent
d1d9711123
commit
bf24b827e4
@ -1,6 +1,7 @@
|
|||||||
"""Test restream.py."""
|
"""Test restream.py."""
|
||||||
|
|
||||||
from unittest import TestCase, main
|
from unittest import TestCase, main
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
from frigate.config import FrigateConfig
|
from frigate.config import FrigateConfig
|
||||||
from frigate.restream import RestreamApi
|
from frigate.restream import RestreamApi
|
||||||
@ -42,14 +43,16 @@ class TestRestream(TestCase):
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
def test_rtsp_stream(self) -> None:
|
@patch("frigate.restream.requests")
|
||||||
|
def test_rtsp_stream(self, mock_requests) -> None:
|
||||||
"""Test that the normal rtsp stream is sent plainly."""
|
"""Test that the normal rtsp stream is sent plainly."""
|
||||||
frigate_config = FrigateConfig(**self.config)
|
frigate_config = FrigateConfig(**self.config)
|
||||||
restream = RestreamApi(frigate_config)
|
restream = RestreamApi(frigate_config)
|
||||||
restream.add_cameras()
|
restream.add_cameras()
|
||||||
assert restream.relays["back"].startswith("rtsp")
|
assert restream.relays["back"].startswith("rtsp")
|
||||||
|
|
||||||
def test_http_stream(self) -> None:
|
@patch("frigate.restream.requests")
|
||||||
|
def test_http_stream(self, mock_requests) -> None:
|
||||||
"""Test that the http stream is sent via ffmpeg."""
|
"""Test that the http stream is sent via ffmpeg."""
|
||||||
frigate_config = FrigateConfig(**self.config)
|
frigate_config = FrigateConfig(**self.config)
|
||||||
restream = RestreamApi(frigate_config)
|
restream = RestreamApi(frigate_config)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user