chore: add a test for unmarshalling a big endian message (#156)
This commit is contained in:
@@ -545,3 +545,24 @@ def test_unmarshall_large_message():
|
|||||||
"org.freedesktop.DBus.Introspectable": {},
|
"org.freedesktop.DBus.Introspectable": {},
|
||||||
"org.freedesktop.DBus.Properties": {},
|
"org.freedesktop.DBus.Properties": {},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def test_unmarshall_big_endian_message():
|
||||||
|
"""Test we can unmarshall a big endian message."""
|
||||||
|
msg = (
|
||||||
|
b"B\x01\x00\x01\x00\x00\x00 \x00\x00\x00\x00\x00\x00\x00\x82"
|
||||||
|
b"\x01\x01o\x00\x00\x00\x00\x01/\x00\x00\x00\x00\x00\x00\x00"
|
||||||
|
b'\x02\x01s\x00\x00\x00\x00"org.freedesktop.DBus.ObjectManag'
|
||||||
|
b"er\x00\x00\x00\x00\x00\x00\x03\x01s\x00\x00\x00\x00\x11GetManagedOb"
|
||||||
|
b"jects\x00\x00\x00\x00\x00\x00\x00\x06\x01s\x00\x00\x00\x00\torg."
|
||||||
|
b"bluez\x00\x00\x00\x00\x00\x00\x00\x08\x01g\x00\x04ussv\x00\x00\x00"
|
||||||
|
b"\x00\x00\x00\x00\x00\x00\x00*\x00\x00\x00\x03zip\x00"
|
||||||
|
b"\x00\x00\x00\x07Trusted\x00\x01b\x00\x00\x00\x00\x00\x01"
|
||||||
|
)
|
||||||
|
|
||||||
|
stream = io.BytesIO(msg)
|
||||||
|
unmarshaller = Unmarshaller(stream)
|
||||||
|
unmarshaller.unmarshall()
|
||||||
|
message = unmarshaller.message
|
||||||
|
unpacked = unpack_variants(message.body)
|
||||||
|
assert unpacked == [42, "zip", "Trusted", True]
|
||||||
|
|||||||
Reference in New Issue
Block a user