handle and test DCU Command responses
This commit is contained in:
@@ -821,6 +821,17 @@ def dcu_command_ind_msg(): # 0x4510
|
||||
msg += b'\x15'
|
||||
return msg
|
||||
|
||||
@pytest.fixture
|
||||
def dcu_command_rsp_msg(): # 0x1510
|
||||
msg = b'\xa5\x11\x00\x10\x15\x94\x03' +get_dcu_sn() +b'\x05\x01'
|
||||
msg += total()
|
||||
msg += hb()
|
||||
msg += b'\x00\x00\x00\x00'
|
||||
msg += b'\x01\x01\x01'
|
||||
msg += correct_checksum(msg)
|
||||
msg += b'\x15'
|
||||
return msg
|
||||
|
||||
@pytest.fixture
|
||||
def config_tsun_allow_all():
|
||||
Config.act_config = {
|
||||
@@ -2413,7 +2424,7 @@ async def test_proxy_at_blocked(my_loop, config_tsun_inv1, patch_open_connection
|
||||
assert Proxy.mqtt.data == "+ok"
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_dcu_cmd(my_loop, config_tsun_allow_all, dcu_dev_ind_msg, dcu_dev_rsp_msg, dcu_data_ind_msg, dcu_data_rsp_msg, dcu_command_ind_msg, at_command_rsp_msg):
|
||||
async def test_dcu_cmd(my_loop, config_tsun_allow_all, dcu_dev_ind_msg, dcu_dev_rsp_msg, dcu_data_ind_msg, dcu_data_rsp_msg, dcu_command_ind_msg, dcu_command_rsp_msg):
|
||||
_ = config_tsun_allow_all
|
||||
m = MemoryStream(dcu_dev_ind_msg, (0,), True)
|
||||
m.read() # read device ind
|
||||
@@ -2447,15 +2458,15 @@ async def test_dcu_cmd(my_loop, config_tsun_allow_all, dcu_dev_ind_msg, dcu_dev_
|
||||
assert Proxy.mqtt.key == ''
|
||||
assert Proxy.mqtt.data == ""
|
||||
|
||||
# m.append_msg(at_command_rsp_msg)
|
||||
# m.read() # read at resp
|
||||
# assert m.control == 0x1510
|
||||
# assert str(m.seq) == '03:03'
|
||||
# assert m.ifc.rx_get()==b''
|
||||
# assert m.ifc.tx_fifo.get()==b''
|
||||
# assert m.ifc.fwd_fifo.get()==b''
|
||||
# assert Proxy.mqtt.key == 'tsun/at_resp'
|
||||
# assert Proxy.mqtt.data == "+ok"
|
||||
m.append_msg(dcu_command_rsp_msg)
|
||||
m.read() # read at resp
|
||||
assert m.control == 0x1510
|
||||
assert str(m.seq) == '03:94'
|
||||
assert m.ifc.rx_get()==b''
|
||||
assert m.ifc.tx_fifo.get()==b''
|
||||
assert m.ifc.fwd_fifo.get()==b''
|
||||
assert Proxy.mqtt.key == 'tsun/dcu_resp'
|
||||
assert Proxy.mqtt.data == "+ok"
|
||||
Proxy.mqtt.clear() # clear last test result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
Reference in New Issue
Block a user