@@ -67,29 +67,62 @@ async def test_streams_get(
6767 assert resp == snapshot
6868
6969
70- async def test_streams_add (
70+ async def test_streams_add_list (
7171 responses : aioresponses ,
7272 rest_client : Go2RtcRestClient ,
7373) -> None :
7474 """Test add stream."""
7575 url = f"{ URL } { _StreamClient .PATH } "
76+ camera = "camera.12mp_fluent"
7677 params = {
77- "name" : " camera.12mp_fluent" ,
78+ "name" : camera ,
7879 "src" : [
7980 "rtsp://test:test@192.168.10.105:554/Preview_06_sub" ,
80- "ffmpeg:camera.12mp_fluent #audio=opus" ,
81+ f "ffmpeg:{ camera } #audio=opus" ,
8182 ],
8283 }
8384 responses .put (
8485 url
85- + "?name=camera.12mp_fluent "
86- + "&src=ffmpeg%253Acamera.12mp_fluent %2523audio%253Dopus"
86+ + f "?name={ camera } "
87+ + f "&src=ffmpeg%253A { camera } %2523audio%253Dopus"
8788 + "&src=rtsp%253A%252F%252Ftest%253Atest%2540192.168.10.105%253A554%252F"
8889 + "Preview_06_sub" ,
8990 status = 200 ,
9091 )
9192 await rest_client .streams .add (
92- "camera.12mp_fluent" , "rtsp://test:test@192.168.10.105:554/Preview_06_sub"
93+ camera ,
94+ [
95+ "rtsp://test:test@192.168.10.105:554/Preview_06_sub" ,
96+ f"ffmpeg:{ camera } #audio=opus" ,
97+ ],
98+ )
99+
100+ responses .assert_called_once_with (
101+ url , method = METH_PUT , params = params , timeout = ClientTimeout (total = 10 )
102+ )
103+
104+
105+ async def test_streams_add_str (
106+ responses : aioresponses ,
107+ rest_client : Go2RtcRestClient ,
108+ ) -> None :
109+ """Test add stream."""
110+ url = f"{ URL } { _StreamClient .PATH } "
111+ camera = "camera.12mp_fluent"
112+ params = {
113+ "name" : camera ,
114+ "src" : "rtsp://test:test@192.168.10.105:554/Preview_06_sub" ,
115+ }
116+ responses .put (
117+ url
118+ + f"?name={ camera } "
119+ + "&src=rtsp%253A%252F%252Ftest%253Atest%2540192.168.10.105%253A554%252F"
120+ + "Preview_06_sub" ,
121+ status = 200 ,
122+ )
123+ await rest_client .streams .add (
124+ camera ,
125+ "rtsp://test:test@192.168.10.105:554/Preview_06_sub" ,
93126 )
94127
95128 responses .assert_called_once_with (
0 commit comments