File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -226,6 +226,26 @@ async def test_play_siren_public_no_body(
226226 assert kwargs ["json" ] == {"duration" : 5 }
227227
228228
229+ @pytest .mark .asyncio ()
230+ async def test_play_siren_public_enum_duration (
231+ protect_client : ProtectApiClient ,
232+ ) -> None :
233+ """Passing a SirenDuration enum value directly should be forwarded as-is."""
234+ protect_client .api_request_raw = AsyncMock (return_value = None )
235+ await protect_client .play_siren_public (SIREN_ID , duration = SirenDuration .TWENTY )
236+ _ , kwargs = protect_client .api_request_raw .call_args
237+ assert kwargs ["json" ] == {"duration" : SirenDuration .TWENTY }
238+
239+
240+ @pytest .mark .asyncio ()
241+ async def test_play_siren_public_invalid_duration (
242+ protect_client : ProtectApiClient ,
243+ ) -> None :
244+ """An integer that is not a valid SirenDuration value must raise BadRequest."""
245+ with pytest .raises (BadRequest ):
246+ await protect_client .play_siren_public (SIREN_ID , duration = 99 )
247+
248+
229249@pytest .mark .asyncio ()
230250async def test_stop_siren_public (protect_client : ProtectApiClient ) -> None :
231251 protect_client .api_request_raw = AsyncMock (return_value = None )
You can’t perform that action at this time.
0 commit comments