tests: Use python3 compatible dict operation
This patch is made by using 2to3 command. $ find . -name *.py | xargs 2to3 -f dict -w -n Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
This commit is contained in:
parent
89896c0008
commit
35d8c2545e
9 changed files with 38 additions and 38 deletions
|
@ -413,7 +413,7 @@ def add_ap(apdev, params, wait_enabled=True, no_enable=False, timeout=30,
|
|||
for field in fields:
|
||||
if field in params:
|
||||
hapd.set(field, params[field])
|
||||
for f,v in params.items():
|
||||
for f,v in list(params.items()):
|
||||
if f in fields:
|
||||
continue
|
||||
if isinstance(v, list):
|
||||
|
|
|
@ -194,7 +194,7 @@ def main():
|
|||
logger.debug("Import test cases from " + t)
|
||||
mod = __import__(m.group(1))
|
||||
test_modules.append(mod.__name__.replace('test_', '', 1))
|
||||
for key,val in mod.__dict__.iteritems():
|
||||
for key,val in mod.__dict__.items():
|
||||
if key.startswith("test_"):
|
||||
tests.append(val)
|
||||
test_names = list(set([t.__name__.replace('test_', '', 1) for t in tests]))
|
||||
|
|
|
@ -924,7 +924,7 @@ def generic_ap_ft_eap(dev, apdev, vlan=False, cui=False, over_ds=False,
|
|||
params["ieee8021x"] = "1"
|
||||
if vlan:
|
||||
params["dynamic_vlan"] = "1"
|
||||
params = dict(radius.items() + params.items())
|
||||
params = dict(list(radius.items()) + list(params.items()))
|
||||
hapd = hostapd.add_ap(apdev[0], params)
|
||||
key_mgmt = hapd.get_config()['key_mgmt']
|
||||
if key_mgmt.split(' ')[0] != "FT-EAP":
|
||||
|
@ -934,7 +934,7 @@ def generic_ap_ft_eap(dev, apdev, vlan=False, cui=False, over_ds=False,
|
|||
params["ieee8021x"] = "1"
|
||||
if vlan:
|
||||
params["dynamic_vlan"] = "1"
|
||||
params = dict(radius.items() + params.items())
|
||||
params = dict(list(radius.items()) + list(params.items()))
|
||||
hapd1 = hostapd.add_ap(apdev[1], params)
|
||||
|
||||
run_roams(dev[0], apdev, hapd, hapd1, ssid, passphrase, eap=True,
|
||||
|
@ -1025,7 +1025,7 @@ def generic_ap_ft_eap_pull(dev, apdev, vlan=False):
|
|||
params["pmk_r1_push"] = "0"
|
||||
if vlan:
|
||||
params["dynamic_vlan"] = "1"
|
||||
params = dict(radius.items() + params.items())
|
||||
params = dict(list(radius.items()) + list(params.items()))
|
||||
hapd = hostapd.add_ap(apdev[0], params)
|
||||
key_mgmt = hapd.get_config()['key_mgmt']
|
||||
if key_mgmt.split(' ')[0] != "FT-EAP":
|
||||
|
@ -1036,7 +1036,7 @@ def generic_ap_ft_eap_pull(dev, apdev, vlan=False):
|
|||
params["pmk_r1_push"] = "0"
|
||||
if vlan:
|
||||
params["dynamic_vlan"] = "1"
|
||||
params = dict(radius.items() + params.items())
|
||||
params = dict(list(radius.items()) + list(params.items()))
|
||||
hapd1 = hostapd.add_ap(apdev[1], params)
|
||||
|
||||
run_roams(dev[0], apdev, hapd, hapd1, ssid, passphrase, eap=True,
|
||||
|
@ -1063,7 +1063,7 @@ def test_ap_ft_eap_pull_wildcard(dev, apdev):
|
|||
params["r1kh"] = "00:00:00:00:00:00 00:00:00:00:00:00 00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff"
|
||||
params["ft_psk_generate_local"] = "1"
|
||||
params["eap_server"] = "0"
|
||||
params = dict(radius.items() + params.items())
|
||||
params = dict(list(radius.items()) + list(params.items()))
|
||||
hapd = hostapd.add_ap(apdev[0], params)
|
||||
params = ft_params2(ssid=ssid, passphrase=passphrase, discovery=True)
|
||||
params['wpa_key_mgmt'] = "WPA-EAP FT-EAP"
|
||||
|
@ -1073,7 +1073,7 @@ def test_ap_ft_eap_pull_wildcard(dev, apdev):
|
|||
params["r1kh"] = "00:00:00:00:00:00 00:00:00:00:00:00 00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff"
|
||||
params["ft_psk_generate_local"] = "1"
|
||||
params["eap_server"] = "0"
|
||||
params = dict(radius.items() + params.items())
|
||||
params = dict(list(radius.items()) + list(params.items()))
|
||||
hapd1 = hostapd.add_ap(apdev[1], params)
|
||||
|
||||
run_roams(dev[0], apdev, hapd, hapd1, ssid, passphrase, eap=True)
|
||||
|
@ -1172,13 +1172,13 @@ def test_ap_ft_mismatching_rrb_key_push_eap(dev, apdev):
|
|||
params["ieee80211w"] = "2";
|
||||
params['wpa_key_mgmt'] = "FT-EAP"
|
||||
params["ieee8021x"] = "1"
|
||||
params = dict(radius.items() + params.items())
|
||||
params = dict(list(radius.items()) + list(params.items()))
|
||||
hapd0 = hostapd.add_ap(apdev[0], params)
|
||||
params = ft_params2_incorrect_rrb_key(ssid=ssid, passphrase=passphrase)
|
||||
params["ieee80211w"] = "2";
|
||||
params['wpa_key_mgmt'] = "FT-EAP"
|
||||
params["ieee8021x"] = "1"
|
||||
params = dict(radius.items() + params.items())
|
||||
params = dict(list(radius.items()) + list(params.items()))
|
||||
hapd1 = hostapd.add_ap(apdev[1], params)
|
||||
|
||||
run_roams(dev[0], apdev, hapd0, hapd1, ssid, passphrase, over_ds=True,
|
||||
|
@ -1194,13 +1194,13 @@ def test_ap_ft_mismatching_rrb_key_pull_eap(dev, apdev):
|
|||
params["pmk_r1_push"] = "0"
|
||||
params['wpa_key_mgmt'] = "FT-EAP"
|
||||
params["ieee8021x"] = "1"
|
||||
params = dict(radius.items() + params.items())
|
||||
params = dict(list(radius.items()) + list(params.items()))
|
||||
hapd0 = hostapd.add_ap(apdev[0], params)
|
||||
params = ft_params2_incorrect_rrb_key(ssid=ssid, passphrase=passphrase)
|
||||
params["pmk_r1_push"] = "0"
|
||||
params['wpa_key_mgmt'] = "FT-EAP"
|
||||
params["ieee8021x"] = "1"
|
||||
params = dict(radius.items() + params.items())
|
||||
params = dict(list(radius.items()) + list(params.items()))
|
||||
hapd1 = hostapd.add_ap(apdev[1], params)
|
||||
|
||||
run_roams(dev[0], apdev, hapd0, hapd1, ssid, passphrase, over_ds=True,
|
||||
|
@ -1217,7 +1217,7 @@ def test_ap_ft_mismatching_r0kh_id_pull_eap(dev, apdev):
|
|||
params["nas_identifier"] = "nas0.w1.fi"
|
||||
params['wpa_key_mgmt'] = "FT-EAP"
|
||||
params["ieee8021x"] = "1"
|
||||
params = dict(radius.items() + params.items())
|
||||
params = dict(list(radius.items()) + list(params.items()))
|
||||
hostapd.add_ap(apdev[0], params)
|
||||
dev[0].connect(ssid, key_mgmt="FT-EAP", proto="WPA2", ieee80211w="1",
|
||||
eap="GPSK", identity="gpsk user",
|
||||
|
@ -1228,7 +1228,7 @@ def test_ap_ft_mismatching_r0kh_id_pull_eap(dev, apdev):
|
|||
params["pmk_r1_push"] = "0"
|
||||
params['wpa_key_mgmt'] = "FT-EAP"
|
||||
params["ieee8021x"] = "1"
|
||||
params = dict(radius.items() + params.items())
|
||||
params = dict(list(radius.items()) + list(params.items()))
|
||||
hostapd.add_ap(apdev[1], params)
|
||||
|
||||
dev[0].scan_for_bss(apdev[1]['bssid'], freq="2412")
|
||||
|
@ -1244,13 +1244,13 @@ def test_ap_ft_mismatching_rrb_r0kh_push_eap(dev, apdev):
|
|||
params["ieee80211w"] = "2";
|
||||
params['wpa_key_mgmt'] = "FT-EAP"
|
||||
params["ieee8021x"] = "1"
|
||||
params = dict(radius.items() + params.items())
|
||||
params = dict(list(radius.items()) + list(params.items()))
|
||||
hapd0 = hostapd.add_ap(apdev[0], params)
|
||||
params = ft_params2_r0kh_mismatch(ssid=ssid, passphrase=passphrase)
|
||||
params["ieee80211w"] = "2";
|
||||
params['wpa_key_mgmt'] = "FT-EAP"
|
||||
params["ieee8021x"] = "1"
|
||||
params = dict(radius.items() + params.items())
|
||||
params = dict(list(radius.items()) + list(params.items()))
|
||||
hapd1 = hostapd.add_ap(apdev[1], params)
|
||||
|
||||
run_roams(dev[0], apdev, hapd0, hapd1, ssid, passphrase, over_ds=True,
|
||||
|
@ -1266,13 +1266,13 @@ def test_ap_ft_mismatching_rrb_r0kh_pull_eap(dev, apdev):
|
|||
params["pmk_r1_push"] = "0"
|
||||
params['wpa_key_mgmt'] = "FT-EAP"
|
||||
params["ieee8021x"] = "1"
|
||||
params = dict(radius.items() + params.items())
|
||||
params = dict(list(radius.items()) + list(params.items()))
|
||||
hapd0 = hostapd.add_ap(apdev[0], params)
|
||||
params = ft_params2(ssid=ssid, passphrase=passphrase)
|
||||
params["pmk_r1_push"] = "0"
|
||||
params['wpa_key_mgmt'] = "FT-EAP"
|
||||
params["ieee8021x"] = "1"
|
||||
params = dict(radius.items() + params.items())
|
||||
params = dict(list(radius.items()) + list(params.items()))
|
||||
hapd1 = hostapd.add_ap(apdev[1], params)
|
||||
|
||||
run_roams(dev[0], apdev, hapd0, hapd1, ssid, passphrase, over_ds=True,
|
||||
|
@ -2269,7 +2269,7 @@ def test_ap_ft_internal_rrb_check(dev, apdev):
|
|||
params = ft_params1(ssid=ssid, passphrase=passphrase)
|
||||
params['wpa_key_mgmt'] = "FT-EAP"
|
||||
params["ieee8021x"] = "1"
|
||||
params = dict(radius.items() + params.items())
|
||||
params = dict(list(radius.items()) + list(params.items()))
|
||||
hapd = hostapd.add_ap(apdev[0], params)
|
||||
key_mgmt = hapd.get_config()['key_mgmt']
|
||||
if key_mgmt.split(' ')[0] != "FT-EAP":
|
||||
|
@ -2586,7 +2586,7 @@ def test_ap_ft_eap_ap_config_change(dev, apdev):
|
|||
params["r0kh"] = "ff:ff:ff:ff:ff:ff * 00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff"
|
||||
params["r1kh"] = "00:00:00:00:00:00 00:00:00:00:00:00 00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff"
|
||||
params["eap_server"] = "0"
|
||||
params = dict(radius.items() + params.items())
|
||||
params = dict(list(radius.items()) + list(params.items()))
|
||||
hapd = hostapd.add_ap(apdev[0], params)
|
||||
|
||||
dev[0].connect(ssid, key_mgmt="FT-EAP WPA-EAP", proto="WPA2",
|
||||
|
@ -2617,13 +2617,13 @@ def test_ap_ft_eap_sha384(dev, apdev):
|
|||
params["ieee80211w"] = "2";
|
||||
params['wpa_key_mgmt'] = "FT-EAP-SHA384"
|
||||
params["ieee8021x"] = "1"
|
||||
params = dict(radius.items() + params.items())
|
||||
params = dict(list(radius.items()) + list(params.items()))
|
||||
hapd0 = hostapd.add_ap(apdev[0], params)
|
||||
params = ft_params2(ssid=ssid, passphrase=passphrase)
|
||||
params["ieee80211w"] = "2";
|
||||
params['wpa_key_mgmt'] = "FT-EAP-SHA384"
|
||||
params["ieee8021x"] = "1"
|
||||
params = dict(radius.items() + params.items())
|
||||
params = dict(list(radius.items()) + list(params.items()))
|
||||
hapd1 = hostapd.add_ap(apdev[1], params)
|
||||
|
||||
run_roams(dev[0], apdev, hapd0, hapd1, ssid, passphrase, eap=True,
|
||||
|
@ -2639,13 +2639,13 @@ def test_ap_ft_eap_sha384_over_ds(dev, apdev):
|
|||
params["ieee80211w"] = "2";
|
||||
params['wpa_key_mgmt'] = "FT-EAP-SHA384"
|
||||
params["ieee8021x"] = "1"
|
||||
params = dict(radius.items() + params.items())
|
||||
params = dict(list(radius.items()) + list(params.items()))
|
||||
hapd0 = hostapd.add_ap(apdev[0], params)
|
||||
params = ft_params2(ssid=ssid, passphrase=passphrase)
|
||||
params["ieee80211w"] = "2";
|
||||
params['wpa_key_mgmt'] = "FT-EAP-SHA384"
|
||||
params["ieee8021x"] = "1"
|
||||
params = dict(radius.items() + params.items())
|
||||
params = dict(list(radius.items()) + list(params.items()))
|
||||
hapd1 = hostapd.add_ap(apdev[1], params)
|
||||
|
||||
run_roams(dev[0], apdev, hapd0, hapd1, ssid, passphrase, over_ds=True,
|
||||
|
|
|
@ -6120,7 +6120,7 @@ def test_ap_hs20_terms_and_conditions_coa(dev, apdev):
|
|||
Vendor_Specific=vsa)
|
||||
reply = srv.SendPacket(req)
|
||||
logger.debug("RADIUS response from hostapd")
|
||||
for i in reply.keys():
|
||||
for i in list(reply.keys()):
|
||||
logger.debug("%s: %s" % (i, reply[i]))
|
||||
if reply.code != pyrad.packet.CoAACK:
|
||||
raise Exception("CoA-Request failed")
|
||||
|
|
|
@ -429,7 +429,7 @@ def generic_pmksa_cache_preauth(dev, apdev, extraparams, identity, databridge,
|
|||
try:
|
||||
params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
|
||||
params['bridge'] = 'ap-br0'
|
||||
for key, value in extraparams[0].iteritems():
|
||||
for key, value in extraparams[0].items():
|
||||
params[key] = value
|
||||
|
||||
hapd = hostapd.add_ap(apdev[0], params)
|
||||
|
@ -445,7 +445,7 @@ def generic_pmksa_cache_preauth(dev, apdev, extraparams, identity, databridge,
|
|||
params['bridge'] = 'ap-br0'
|
||||
params['rsn_preauth'] = '1'
|
||||
params['rsn_preauth_interfaces'] = databridge
|
||||
for key, value in extraparams[1].iteritems():
|
||||
for key, value in extraparams[1].items():
|
||||
params[key] = value
|
||||
hostapd.add_ap(apdev[1], params)
|
||||
bssid1 = apdev[1]['bssid']
|
||||
|
|
|
@ -362,7 +362,7 @@ def _test_radius_acct_ipaddr(dev, apdev):
|
|||
def send_and_check_reply(srv, req, code, error_cause=0):
|
||||
reply = srv.SendPacket(req)
|
||||
logger.debug("RADIUS response from hostapd")
|
||||
for i in reply.keys():
|
||||
for i in list(reply.keys()):
|
||||
logger.debug("%s: %s" % (i, reply[i]))
|
||||
if reply.code != code:
|
||||
raise Exception("Unexpected response code")
|
||||
|
|
|
@ -1326,9 +1326,9 @@ def test_scan_ies(dev, apdev):
|
|||
if not bss or 'beacon_ie' not in bss:
|
||||
raise Exception("beacon_ie not present")
|
||||
ie = parse_ie(bss['ie'])
|
||||
logger.info("ie: " + str(ie.keys()))
|
||||
logger.info("ie: " + str(list(ie.keys())))
|
||||
beacon_ie = parse_ie(bss['beacon_ie'])
|
||||
logger.info("beacon_ie: " + str(ie.keys()))
|
||||
logger.info("beacon_ie: " + str(list(ie.keys())))
|
||||
if bss['ie'] == bss['beacon_ie']:
|
||||
raise Exception("Both ie and beacon_ie show same data")
|
||||
|
||||
|
@ -1684,7 +1684,7 @@ def test_scan_multi_bssid_check_ie(dev, apdev):
|
|||
raise Exception("beacon_ie not present in trans_bss")
|
||||
|
||||
beacon_ie = parse_ie(trans_bss['beacon_ie'])
|
||||
logger.info("trans_bss beacon_ie: " + str(beacon_ie.keys()))
|
||||
logger.info("trans_bss beacon_ie: " + str(list(beacon_ie.keys())))
|
||||
|
||||
bssid = bssid[0:16] + '1'
|
||||
nontrans_bss1 = dev[0].get_bss(bssid)
|
||||
|
@ -1695,12 +1695,12 @@ def test_scan_multi_bssid_check_ie(dev, apdev):
|
|||
raise Exception("beacon_ie not present in nontrans_bss1")
|
||||
|
||||
nontx_beacon_ie = parse_ie(nontrans_bss1['beacon_ie'])
|
||||
logger.info("nontrans_bss1 beacon_ie: " + str(nontx_beacon_ie.keys()))
|
||||
logger.info("nontrans_bss1 beacon_ie: " + str(list(nontx_beacon_ie.keys())))
|
||||
|
||||
if 71 in beacon_ie.keys():
|
||||
ie_list = beacon_ie.keys()
|
||||
if 71 in list(beacon_ie.keys()):
|
||||
ie_list = list(beacon_ie.keys())
|
||||
ie_list.remove(71)
|
||||
if ie_list != nontx_beacon_ie.keys():
|
||||
if ie_list != list(nontx_beacon_ie.keys()):
|
||||
raise Exception("check IE failed")
|
||||
|
||||
def elem_fms1():
|
||||
|
|
|
@ -958,7 +958,7 @@ class WpaSupplicant:
|
|||
"mean_data_rate": 1500,
|
||||
}
|
||||
cmd = "WMM_AC_ADDTS %s tsid=%d up=%d" % (direction, tsid, up)
|
||||
for (key, value) in params.iteritems():
|
||||
for (key, value) in params.items():
|
||||
cmd += " %s=%d" % (key, value)
|
||||
if extra:
|
||||
cmd += " " + extra
|
||||
|
|
|
@ -161,7 +161,7 @@ def main():
|
|||
if m:
|
||||
mod = __import__(m.group(1))
|
||||
test_modules.append(mod.__name__.replace('test_', '', 1))
|
||||
for key,val in mod.__dict__.iteritems():
|
||||
for key,val in mod.__dict__.items():
|
||||
if key.startswith("test_"):
|
||||
tests.append(val)
|
||||
test_names = list(set([t.__name__.replace('test_', '', 1) for t in tests]))
|
||||
|
@ -173,7 +173,7 @@ def main():
|
|||
if m:
|
||||
mod = __import__(m.group(1))
|
||||
test_modules.append(mod.__name__.replace('test_', '', 1))
|
||||
for key,val in mod.__dict__.iteritems():
|
||||
for key,val in mod.__dict__.items():
|
||||
if key.startswith("test_"):
|
||||
hwsim_tests.append(val)
|
||||
|
||||
|
|
Loading…
Reference in a new issue