libnm/tests: fix GetAccessPoints() in test-networkmanager-service.py for hidden APs
authorThomas Haller <thaller@redhat.com>
Mon, 5 Jan 2015 12:50:56 +0000 (13:50 +0100)
committerThomas Haller <thaller@redhat.com>
Mon, 5 Jan 2015 13:18:53 +0000 (14:18 +0100)
There was a bug checking for "if a.ssid():". Refactor the whole line to
use a list comprehension.

tools/test-networkmanager-service.py

index c3c2347..50803c8 100755 (executable)
@@ -356,11 +356,7 @@ class WifiDevice(Device):
     @dbus.service.method(dbus_interface=IFACE_WIFI, in_signature='', out_signature='ao')
     def GetAccessPoints(self):
         # only include non-hidden APs
-        array = []
-        for a in self.aps:
-            if a.ssid():
-                array.append(a)
-        return to_path_array(array)
+        return to_path_array([a for a in self.aps if a.ssid])
 
     @dbus.service.method(dbus_interface=IFACE_WIFI, in_signature='', out_signature='ao')
     def GetAllAccessPoints(self):