libnm/tests: fix handling ByteArray in test-networkmanager-service.py for Python 3
In Python 3, dbus.ByteArray() must be created using a byte string, while strings obtained via DBUS are unicode strings. This was wrong in WifiAp.__get_props() which broke the test test_wifi_ap_added_removed(). File "/usr/lib/python3.3/site-packages/dbus/service.py", line 707, in _message_cb retval = candidate_method(self, *args, **keywords) File "./NetworkManager/tools/test-networkmanager-service.py", line 102, in GetAll return self._get_dbus_properties(iface) File "./NetworkManager/tools/test-networkmanager-service.py", line 96, in _get_dbus_properties return self.__dbus_ifaces[iface]() File "./NetworkManager/tools/test-networkmanager-service.py", line 315, in __get_props props[PP_SSID] = dbus.ByteArray(self.ssid) TypeError: string argument without an encoding https://bugzilla.gnome.org/show_bug.cgi?id=739448
This commit is contained in:
@@ -312,7 +312,7 @@ class WifiAp(ExportedObj):
|
||||
props[PP_FLAGS] = dbus.UInt32(self.flags)
|
||||
props[PP_WPA_FLAGS] = dbus.UInt32(self.wpaf)
|
||||
props[PP_RSN_FLAGS] = dbus.UInt32(self.rsnf)
|
||||
props[PP_SSID] = dbus.ByteArray(self.ssid)
|
||||
props[PP_SSID] = dbus.ByteArray(self.ssid.encode('utf-8'))
|
||||
props[PP_FREQUENCY] = dbus.UInt32(self.freq)
|
||||
props[PP_HW_ADDRESS] = self.bssid
|
||||
props[PP_MODE] = dbus.UInt32(2) # NM_802_11_MODE_INFRA
|
||||
|
Reference in New Issue
Block a user