From: Masashi Honma Date: Mon, 4 Feb 2019 00:30:15 +0000 (+0200) Subject: tests: ElementTree string representation in python3 compatible manner X-Git-Tag: hostap_2_8~445 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=69f58282bc4434a715a54ecc69a964c9a0642c24;p=thirdparty%2Fhostap.git tests: ElementTree string representation in python3 compatible manner Use ET.tostring() to avoid implicit bytes/str conversion issues within ET implementation. Add XML declaration separately to match previous behavior. Signed-off-by: Masashi Honma --- diff --git a/tests/hwsim/test_ap_wps.py b/tests/hwsim/test_ap_wps.py index e66047cbe..8e9aa33c8 100644 --- a/tests/hwsim/test_ap_wps.py +++ b/tests/hwsim/test_ap_wps.py @@ -2806,16 +2806,14 @@ def upnp_soap_action(conn, path, action, include_soap_action=True, if neweventmac: msg = ET.SubElement(act, "NewWLANEventMAC") msg.text = neweventmac - tree = ET.ElementTree(root) - soap = StringIO() - tree.write(soap, xml_declaration=True, encoding='utf-8') headers = { "Content-type": 'text/xml; charset="utf-8"' } if include_soap_action: headers["SOAPAction"] = '"urn:schemas-wifialliance-org:service:WFAWLANConfig:1#%s"' % action elif soap_action_override: headers["SOAPAction"] = soap_action_override - conn.request("POST", path, soap.getvalue(), headers) + decl = b'\n' + conn.request("POST", path, decl + ET.tostring(root), headers) return conn.getresponse() def test_ap_wps_upnp(dev, apdev):