def test_create_message(self):
     message = SMB2CreateRequestLease()
     message['lease_key'] = b"\xff" * 16
     message['lease_state'].set_flag(LeaseState.SMB2_LEASE_HANDLE_CACHING)
     message['lease_duration'] = 10
     expected = b"\xff\xff\xff\xff\xff\xff\xff\xff" \
                b"\xff\xff\xff\xff\xff\xff\xff\xff" \
                b"\x02\x00\x00\x00" \
                b"\x00\x00\x00\x00" \
                b"\x0a\x00\x00\x00\x00\x00\x00\x00"
     actual = message.pack()
     assert len(message) == 32
     assert actual == expected
 def test_parse_message(self):
     actual = SMB2CreateRequestLease()
     data = b"\xff\xff\xff\xff\xff\xff\xff\xff" \
            b"\xff\xff\xff\xff\xff\xff\xff\xff" \
            b"\x02\x00\x00\x00" \
            b"\x00\x00\x00\x00" \
            b"\x0a\x00\x00\x00\x00\x00\x00\x00"
     data = actual.unpack(data)
     assert len(actual) == 32
     assert data == b""
     assert actual['lease_key'].get_value() == b"\xff" * 16
     assert actual['lease_state'].get_value() == \
         LeaseState.SMB2_LEASE_HANDLE_CACHING
     assert actual['lease_flags'].get_value() == 0
     assert actual['lease_duration'].get_value() == 10