]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Replace str.translate() with str.replace()
authorJouni Malinen <j@w1.fi>
Sun, 3 Feb 2019 10:24:49 +0000 (12:24 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 4 Feb 2019 10:26:34 +0000 (12:26 +0200)
This is needed for python3 since the two argument version of
str.translate() is not available for unicode. Furthermore, these cases
of delete colons from the string are simple enough for replace.

Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/test_ap_hs20.py
tests/hwsim/test_cfg80211.py

index ee4a7b0201e8cb6dd10513c7c8ec681b6a7f26f9..c9bc63c77ed4771878e0f723cfc6e6099bf1d0c5 100644 (file)
@@ -1586,7 +1586,7 @@ def test_ap_hs20_disallow_aps(dev, apdev):
     dev[0].scan_for_bss(bssid, freq="2412")
 
     logger.info("Verify disallow_aps bssid")
-    dev[0].request("SET disallow_aps bssid " + bssid.translate(None, ':'))
+    dev[0].request("SET disallow_aps bssid " + bssid.replace(':', ''))
     dev[0].request("INTERWORKING_SELECT auto")
     ev = dev[0].wait_event(["INTERWORKING-NO-MATCH"], timeout=15)
     if ev is None:
@@ -1605,7 +1605,7 @@ def test_ap_hs20_disallow_aps(dev, apdev):
     dev[0].request("SET disallow_aps ")
     interworking_select(dev[0], bssid, "home", freq="2412")
 
-    dev[0].request("SET disallow_aps bssid " + bssid.translate(None, ':'))
+    dev[0].request("SET disallow_aps bssid " + bssid.replace(':', ''))
     ret = dev[0].request("INTERWORKING_CONNECT " + bssid)
     if "FAIL" not in ret:
         raise Exception("INTERWORKING_CONNECT to disallowed BSS not rejected")
index 2a84cd2dfba2eff1d6d8f3cd682f49da1dd683bd..0890984fcc3dcfb34d1980ce88a78634aafce1d6 100644 (file)
@@ -70,7 +70,7 @@ def test_cfg80211_tx_frame(dev, apdev, params):
 
     dev[0].p2p_start_go(freq='2412')
     go = WpaSupplicant(dev[0].group_ifname)
-    frame = binascii.unhexlify("d0000000020000000100" + go.own_addr().translate(None, ':') + "02000000010000000409506f9a090001dd5e506f9a0902020025080401001f0502006414060500585804510b0906000200000000000b1000585804510b0102030405060708090a0b0d1d000200000000000108000000000000000000101100084465766963652041110500585804510bdd190050f204104a0001101012000200011049000600372a000120")
+    frame = binascii.unhexlify("d0000000020000000100" + go.own_addr().replace(':', '') + "02000000010000000409506f9a090001dd5e506f9a0902020025080401001f0502006414060500585804510b0906000200000000000b1000585804510b0102030405060708090a0b0d1d000200000000000108000000000000000000101100084465766963652041110500585804510bdd190050f204104a0001101012000200011049000600372a000120")
     ifindex = int(go.get_driver_status_field("ifindex"))
     res = nl80211_frame(go, ifindex, frame, freq=2422, duration=500,
                         offchannel_tx_ok=True)