2023-04-16 09:44:09 +00:00
|
|
|
from twnet_parser.packet import parse7, TwPacket
|
|
|
|
from twnet_parser.messages7.game.cl_call_vote import MsgClCallVote
|
2023-04-07 12:31:04 +00:00
|
|
|
|
2023-04-16 09:44:09 +00:00
|
|
|
from typing import cast
|
|
|
|
|
|
|
|
def test_parse_7_real_call_vote() -> None:
|
|
|
|
packet: TwPacket = parse7(b'\x02\x7e\x01\x48\x1f\x93\xd7' \
|
2023-04-07 12:31:04 +00:00
|
|
|
b'\x40\x10\x0a' \
|
|
|
|
b'\x80\x01' \
|
|
|
|
b'\x6f\x70\x74\x69\x6f\x6e\x00' \
|
|
|
|
b'\x74\x65\x73\x74\x00' \
|
|
|
|
b'\x00' \
|
|
|
|
b'\x00')
|
|
|
|
|
|
|
|
assert packet.version == '0.7'
|
|
|
|
|
|
|
|
assert packet.header.token == b'\x48\x1f\x93\xd7'
|
|
|
|
assert packet.header.num_chunks == 1
|
|
|
|
assert packet.header.ack == 638
|
|
|
|
|
|
|
|
assert packet.header.flags.control is False
|
|
|
|
assert packet.header.flags.compression is False
|
|
|
|
|
|
|
|
assert len(packet.messages) == 1
|
|
|
|
|
2023-04-16 09:44:09 +00:00
|
|
|
msg: MsgClCallVote = cast(MsgClCallVote, packet.messages[0])
|
2023-04-07 12:31:04 +00:00
|
|
|
|
|
|
|
assert msg.message_name == 'cl_call_vote'
|
|
|
|
|
2023-04-07 14:10:56 +00:00
|
|
|
assert msg.type == 'option'
|
2023-04-07 12:31:04 +00:00
|
|
|
assert msg.value == 'test'
|
|
|
|
assert msg.reason == ''
|
2023-04-16 09:44:09 +00:00
|
|
|
assert msg.force is False
|