tests: python3 compatible str/bytes ord()

Need to skip ord() for python3 when going through bytes object (instead
of str object in python2).

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2019-02-03 12:44:17 +02:00
parent 95d013f530
commit c45b969d6a

View File

@ -8,6 +8,7 @@ from remotehost import remote_compatible
import logging
logger = logging.getLogger()
import struct
import sys
import hwsim_utils
import hostapd
@ -201,7 +202,8 @@ def test_tspec_protocol(dev, apdev):
msg['sa'] = apdev[0]['bssid']
# modified parameters
msg['payload'] = struct.pack('BBBB', 17, 1, dialog, 1) + payload[4:12] + struct.pack('B', ord(payload[12]) & ~0x60) + payload[13:]
p12int = payload[12] if sys.version_info[0] > 2 else ord(payload[12])
msg['payload'] = struct.pack('BBBB', 17, 1, dialog, 1) + payload[4:12] + struct.pack('B', p12int & ~0x60) + payload[13:]
hapd.mgmt_tx(msg)
# reject request