|
8 | 8 |
|
9 | 9 | from unittest import mock |
10 | 10 | from unittest import IsolatedAsyncioTestCase |
| 11 | +import pytest |
11 | 12 | from blinkpy.blinkpy import Blink |
12 | 13 | from blinkpy.helpers.util import BlinkURLHandler |
13 | 14 | from blinkpy.sync_module import BlinkSyncModule |
14 | 15 | from blinkpy.camera import BlinkCamera, BlinkCameraMini, BlinkDoorbell |
| 16 | +from blinkpy.livestream import BlinkLiveStream |
15 | 17 | import tests.mock_responses as mresp |
16 | 18 |
|
17 | 19 | CONFIG = { |
@@ -129,6 +131,36 @@ async def test_camera_stream(self, mock_resp): |
129 | 131 | self.assertEqual(await self.camera.get_liveview(), "rtsps://foo.bar") |
130 | 132 | self.assertEqual(await mini_camera.get_liveview(), "rtsps://foo.bar") |
131 | 133 | self.assertEqual(await doorbell_camera.get_liveview(), "rtsps://foo.bar") |
| 134 | + with pytest.raises(NotImplementedError): |
| 135 | + await self.camera.init_livestream() |
| 136 | + with pytest.raises(NotImplementedError): |
| 137 | + await mini_camera.init_livestream() |
| 138 | + with pytest.raises(NotImplementedError): |
| 139 | + await doorbell_camera.init_livestream() |
| 140 | + |
| 141 | + async def test_camera_livestream(self, mock_resp): |
| 142 | + """Test that camera livestream returns correct object.""" |
| 143 | + mock_resp.return_value = { |
| 144 | + "command_id": 1234567890, |
| 145 | + "join_available": True, |
| 146 | + "join_state": "available", |
| 147 | + "server": "immis://1.2.3.4:443/ABCDEFGHIJKMLNOP__IMDS_1234567812345678?client_id=123", |
| 148 | + "duration": 300, |
| 149 | + "extended_duration": 5400, |
| 150 | + "continue_interval": 300, |
| 151 | + "continue_warning": 0, |
| 152 | + "polling_interval": 15, |
| 153 | + "submit_logs": True, |
| 154 | + "new_command": True, |
| 155 | + "media_id": None, |
| 156 | + "options": {"poor_connection": False}, |
| 157 | + "liveview_token": "abcdefghijklmnopqrstuv", |
| 158 | + } |
| 159 | + mini_camera = BlinkCameraMini(self.blink.sync["test"]) |
| 160 | + doorbell_camera = BlinkDoorbell(self.blink.sync["test"]) |
| 161 | + self.assertIsInstance(await self.camera.init_livestream(), BlinkLiveStream) |
| 162 | + self.assertIsInstance(await mini_camera.init_livestream(), BlinkLiveStream) |
| 163 | + self.assertIsInstance(await doorbell_camera.init_livestream(), BlinkLiveStream) |
132 | 164 |
|
133 | 165 | async def test_different_thumb_api(self, mock_resp): |
134 | 166 | """Test that the correct url is created with new api.""" |
|
0 commit comments