@@ -404,15 +404,20 @@ async def _test_request(
404404 expect_reply = True ,
405405 send_success = True ,
406406 send_timeout = False ,
407- is_end_device = None ,
407+ is_end_device = True ,
408+ node_desc = True ,
408409 ** kwargs
409410):
410411 seq = 123
411412 nwk = 0x2345
412413 ieee = t .EUI64 (b"\x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 " )
413414 dev = app .add_device (ieee , nwk )
414- dev .node_desc = mock .MagicMock ()
415- dev .node_desc .is_end_device = is_end_device
415+
416+ if node_desc :
417+ dev .node_desc = mock .MagicMock ()
418+ dev .node_desc .is_end_device = is_end_device
419+ else :
420+ dev .node_desc = None
416421
417422 def _mock_command (
418423 cmdname , ieee , nwk , src_ep , dst_ep , cluster , profile , radius , options , data
@@ -445,6 +450,12 @@ async def test_request_with_reply(app):
445450 assert r [0 ] == 0
446451
447452
453+ @pytest .mark .asyncio
454+ async def test_request_without_node_desc (app ):
455+ r = await _test_request (app , expect_reply = True , send_success = True , node_desc = False )
456+ assert r [0 ] == 0
457+
458+
448459@pytest .mark .asyncio
449460async def test_request_send_timeout (app ):
450461 r = await _test_request (app , send_timeout = True )
@@ -466,8 +477,7 @@ async def test_request_extended_timeout(app):
466477 assert app ._api ._command .call_args [0 ][8 ] & 0x40 == 0x00
467478 app ._api ._command .reset_mock ()
468479
469- is_end_device = None
470- r = await _test_request (app , True , True , is_end_device = is_end_device )
480+ r = await _test_request (app , True , True , node_desc = False )
471481 assert r [0 ] == xbee_t .TXStatus .SUCCESS
472482 assert app ._api ._command .call_count == 1
473483 assert app ._api ._command .call_args [0 ][8 ] & 0x40 == 0x40
0 commit comments