From b7da11fd95a3a6130ce6cb0c76281bbea424b4ee Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 4 Feb 2019 01:48:43 +0200 Subject: [PATCH] tests: Extend build_wsc_attr() to accept both bytes and str objects This is needed for python3. Signed-off-by: Jouni Malinen --- tests/hwsim/test_ap_wps.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/hwsim/test_ap_wps.py b/tests/hwsim/test_ap_wps.py index 98597f1ed..970a8c203 100644 --- a/tests/hwsim/test_ap_wps.py +++ b/tests/hwsim/test_ap_wps.py @@ -6227,7 +6227,8 @@ def recv_wsc_msg(dev, opcode, msg_type): return msg, msg['wsc_attrs'], msg['raw_attrs'] def build_wsc_attr(attr, payload): - return struct.pack('>HH', attr, len(payload)) + payload + _payload = payload if type(payload) == bytes else payload.encode() + return struct.pack('>HH', attr, len(_payload)) + _payload def build_attr_msg_type(msg_type): return build_wsc_attr(ATTR_MSG_TYPE, struct.pack('B', msg_type))