Skip to content

Commit

Permalink
Add Tests for Pre Nak
Browse files Browse the repository at this point in the history
  • Loading branch information
krkeegan committed Dec 3, 2020
1 parent 9ba2ffe commit 33ac375
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/handler/test_BroadcastCmdResponse.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ def callback(msg, on_done=None):
r = handler.msg_received(proto, msg)
assert r == Msg.FINISHED

# direct Pre NAK
flags = Msg.Flags(Msg.Flags.Type.DIRECT_NAK, False)
msg = Msg.InpStandard(addr, addr, flags, 0x10, 0xFC)
r = handler.msg_received(proto, msg)
assert r == Msg.CONTINUE

# unexpected
flags = Msg.Flags(Msg.Flags.Type.ALL_LINK_BROADCAST, False)
msg = Msg.InpStandard(addr, addr, flags, 0x10, 0x00)
Expand Down
6 changes: 6 additions & 0 deletions tests/handler/test_DeviceDbGet.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ def callback(success, msg, value):
r = handler.msg_received(proto, std_ack)
assert r == Msg.UNKNOWN

# direct Pre NAK
flags = Msg.Flags(Msg.Flags.Type.DIRECT_NAK, False)
msg = Msg.InpStandard(addr, addr, flags, 0x2f, 0xFC)
r = handler.msg_received(proto, msg)
assert r == Msg.CONTINUE

# Try w/ an extended msg.
ext_data = bytes(14)
ext_ack = Msg.OutExtended.direct(addr, 0x2f, 0x00, ext_data)
Expand Down
6 changes: 6 additions & 0 deletions tests/handler/test_ExtendedCmdResponse.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ def callback(msg, on_done=None):
r = handler.msg_received(proto, msg)
assert r == Msg.FINISHED

# direct Pre NAK
flags = Msg.Flags(Msg.Flags.Type.DIRECT_NAK, False)
msg = Msg.InpStandard(addr, addr, flags, 0x2e, 0xFC)
r = handler.msg_received(proto, msg)
assert r == Msg.CONTINUE

# unexpected
flags = Msg.Flags(Msg.Flags.Type.BROADCAST, False)
msg = Msg.InpStandard(addr, addr, flags, 0x2e, 0x00)
Expand Down

0 comments on commit 33ac375

Please sign in to comment.