Test rcon_cmd and sys input fields

This commit is contained in:
ChillerDragon 2023-04-02 09:22:20 +02:00
parent b4b1dc8ff3
commit d6727ddcbe

View file

@ -111,7 +111,7 @@ def test_parse_7_real_multi_chunk_compressed():
assert packet.messages[1].message_name == 'sv_server_settings' assert packet.messages[1].message_name == 'sv_server_settings'
assert packet.messages[2].message_name == 'con_ready' assert packet.messages[2].message_name == 'con_ready'
def teste_parse_7_real_broadcast_input_snap() -> None: def test_parse_7_real_broadcast_input_snap() -> None:
# 0.7 packet header # 0.7 packet header
data: bytes = b'\x00\x07\x03\x4d\xcb\x93\x60' data: bytes = b'\x00\x07\x03\x4d\xcb\x93\x60'
# game.sv_broadcast # game.sv_broadcast
@ -153,3 +153,23 @@ def teste_parse_7_real_broadcast_input_snap() -> None:
assert packet.messages[2].message_name == 'snap_empty' assert packet.messages[2].message_name == 'snap_empty'
assert packet.messages[2].system_message is True assert packet.messages[2].system_message is True
def teste_parse_7_real_rcon_and_input() -> None:
data = b'\x02\x81\x02\x5b\x30\xe5\x81' \
b'\x40\x11\x09\x2b\x74\x75\x6e\x65\x20\x67\x72\x61\x76\x69\x74\x79\x20\x32\x30\x00' \
b'\x00\x11\x29\x80\x5a\x83\x5a\x28\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x21'
packet = parse7(data)
assert len(packet.messages) == 2
rcon = packet.messages[0]
inp = packet.messages[1]
assert rcon.message_name == 'rcon_cmd'
assert rcon.cmd == 'tune gravity 20'
assert inp.message_name == 'input'
assert inp.ack_snapshot == 5760
assert inp.intended_tick == 5763
assert inp.input_size == 40