@@ -446,6 +446,20 @@ async def test_get_extended_address(aioclient_mock: AiohttpClientMocker) -> None
446446 assert await otbr .get_extended_address () == bytes .fromhex (mock_response )
447447
448448
449+ async def test_get_coprocessor_version (aioclient_mock : AiohttpClientMocker ) -> None :
450+ """Test get_coprocessor_version."""
451+ otbr = python_otbr_api .OTBR (BASE_URL , aioclient_mock .create_session ())
452+
453+ mock_response = (
454+ "OPENTHREAD/thread-reference-20200818-1740-g33cc75ed3;"
455+ " NRF52840; Jun 2 2022 14:25:49"
456+ )
457+
458+ aioclient_mock .get (f"{ BASE_URL } /node/coprocessor/version" , json = mock_response )
459+
460+ assert await otbr .get_coprocessor_version () == mock_response
461+
462+
449463async def test_set_enabled_201 (aioclient_mock : AiohttpClientMocker ) -> None :
450464 """Test set_enabled."""
451465 otbr = python_otbr_api .OTBR (BASE_URL , aioclient_mock .create_session ())
@@ -639,3 +653,15 @@ async def test_get_extended_address_invalid(aioclient_mock: AiohttpClientMocker)
639653 aioclient_mock .get (f"{ BASE_URL } /node/ext-address" , text = "unexpected" )
640654 with pytest .raises (python_otbr_api .OTBRError ):
641655 await otbr .get_extended_address ()
656+
657+
658+ async def test_get_coprocessor_version_invalid (aioclient_mock : AiohttpClientMocker ):
659+ """Test get_coprocessor_version with error."""
660+ otbr = python_otbr_api .OTBR (BASE_URL , aioclient_mock .create_session ())
661+
662+ aioclient_mock .get (
663+ f"{ BASE_URL } /node/coprocessor/version" , status = HTTPStatus .NOT_FOUND
664+ )
665+
666+ with pytest .raises (python_otbr_api .OTBRError ):
667+ await otbr .get_coprocessor_version ()
0 commit comments