tests: various refactoring in tools/test-networkmanager-service.py

- no more global variables, except those in the new variable "gl".

- don't pass that bus instance around. Use the singleton gl.bus.

- separate creation of ExportedObj from exporting on D-Bus.

- use enum values loaded from NM via GObject introspection.

- the visible change is that the generated D-Bus paths now start
  counting at one. That is also how NetworkManager behaves, and
  it looks nicer to have no zero ID for an object.
This commit is contained in:
Thomas Haller
2018-05-14 14:22:09 +02:00
parent beca21be80
commit f563a6dfeb
14 changed files with 406 additions and 441 deletions

View File

@@ -9,19 +9,19 @@ AP[1].SSID: wlan0-ap-3
AP[1].MODE: Infra AP[1].MODE: Infra
AP[1].CHAN: 1 AP[1].CHAN: 1
AP[1].RATE: 54 Mbit/s AP[1].RATE: 54 Mbit/s
AP[1].SIGNAL: 61 AP[1].SIGNAL: 88
AP[1].BARS: *** AP[1].BARS: ****
AP[1].SECURITY: WPA1 WPA2 AP[1].SECURITY: WPA1 WPA2
AP[2].IN-USE: AP[2].IN-USE:
AP[2].SSID: wlan0-ap-1 AP[2].SSID: wlan0-ap-2
AP[2].MODE: Infra AP[2].MODE: Infra
AP[2].CHAN: 1 AP[2].CHAN: 1
AP[2].RATE: 54 Mbit/s AP[2].RATE: 54 Mbit/s
AP[2].SIGNAL: 34 AP[2].SIGNAL: 61
AP[2].BARS: ** AP[2].BARS: ***
AP[2].SECURITY: WPA1 WPA2 AP[2].SECURITY: WPA1 WPA2
AP[3].IN-USE: AP[3].IN-USE:
AP[3].SSID: wlan0-ap-2 AP[3].SSID: wlan0-ap-1
AP[3].MODE: Infra AP[3].MODE: Infra
AP[3].CHAN: 1 AP[3].CHAN: 1
AP[3].RATE: 54 Mbit/s AP[3].RATE: 54 Mbit/s

View File

@@ -12,21 +12,21 @@ AP[1].SSID: wlan0-ap-3
AP[1].MODE: Infra AP[1].MODE: Infra
AP[1].CHAN: 1 AP[1].CHAN: 1
AP[1].RATE: 54 Mbit/s AP[1].RATE: 54 Mbit/s
AP[1].SIGNAL: 61 AP[1].SIGNAL: 88
AP[1].BARS: *** AP[1].BARS: ****
AP[1].SECURITY: WPA1 WPA2 AP[1].SECURITY: WPA1 WPA2
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
AP[2].IN-USE: AP[2].IN-USE:
AP[2].SSID: wlan0-ap-1 AP[2].SSID: wlan0-ap-2
AP[2].MODE: Infra AP[2].MODE: Infra
AP[2].CHAN: 1 AP[2].CHAN: 1
AP[2].RATE: 54 Mbit/s AP[2].RATE: 54 Mbit/s
AP[2].SIGNAL: 34 AP[2].SIGNAL: 61
AP[2].BARS: ** AP[2].BARS: ***
AP[2].SECURITY: WPA1 WPA2 AP[2].SECURITY: WPA1 WPA2
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
AP[3].IN-USE: AP[3].IN-USE:
AP[3].SSID: wlan0-ap-2 AP[3].SSID: wlan0-ap-1
AP[3].MODE: Infra AP[3].MODE: Infra
AP[3].CHAN: 1 AP[3].CHAN: 1
AP[3].RATE: 54 Mbit/s AP[3].RATE: 54 Mbit/s

View File

@@ -9,19 +9,19 @@ AP[1].SSID:wlan0-ap-3
AP[1].MODE:Infra AP[1].MODE:Infra
AP[1].CHAN:1 AP[1].CHAN:1
AP[1].RATE:54 Mbit/s AP[1].RATE:54 Mbit/s
AP[1].SIGNAL:61 AP[1].SIGNAL:88
AP[1].BARS:*** AP[1].BARS:****
AP[1].SECURITY:WPA1 WPA2 AP[1].SECURITY:WPA1 WPA2
AP[2].IN-USE: AP[2].IN-USE:
AP[2].SSID:wlan0-ap-1 AP[2].SSID:wlan0-ap-2
AP[2].MODE:Infra AP[2].MODE:Infra
AP[2].CHAN:1 AP[2].CHAN:1
AP[2].RATE:54 Mbit/s AP[2].RATE:54 Mbit/s
AP[2].SIGNAL:34 AP[2].SIGNAL:61
AP[2].BARS:** AP[2].BARS:***
AP[2].SECURITY:WPA1 WPA2 AP[2].SECURITY:WPA1 WPA2
AP[3].IN-USE: AP[3].IN-USE:
AP[3].SSID:wlan0-ap-2 AP[3].SSID:wlan0-ap-1
AP[3].MODE:Infra AP[3].MODE:Infra
AP[3].CHAN:1 AP[3].CHAN:1
AP[3].RATE:54 Mbit/s AP[3].RATE:54 Mbit/s

View File

@@ -5,9 +5,9 @@ returncode: 0
stdout: 304 bytes stdout: 304 bytes
>>> >>>
NAME IN-USE SSID MODE CHAN RATE SIGNAL BARS SECURITY NAME IN-USE SSID MODE CHAN RATE SIGNAL BARS SECURITY
AP[1] wlan0-ap-3 Infra 1 54 Mbit/s 61 *** WPA1 WPA2 AP[1] wlan0-ap-3 Infra 1 54 Mbit/s 88 **** WPA1 WPA2
AP[2] wlan0-ap-1 Infra 1 54 Mbit/s 34 ** WPA1 WPA2 AP[2] wlan0-ap-2 Infra 1 54 Mbit/s 61 *** WPA1 WPA2
AP[3] wlan0-ap-2 Infra 1 54 Mbit/s 29 * WPA1 WPA2 AP[3] wlan0-ap-1 Infra 1 54 Mbit/s 29 * WPA1 WPA2
<<< <<<
stderr: 0 bytes stderr: 0 bytes

View File

@@ -9,9 +9,9 @@ stdout: 460 bytes
========================== ==========================
NAME IN-USE SSID MODE CHAN RATE SIGNAL BARS SECURITY NAME IN-USE SSID MODE CHAN RATE SIGNAL BARS SECURITY
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
AP[1] wlan0-ap-3 Infra 1 54 Mbit/s 61 *** WPA1 WPA2 AP[1] wlan0-ap-3 Infra 1 54 Mbit/s 88 **** WPA1 WPA2
AP[2] wlan0-ap-1 Infra 1 54 Mbit/s 34 ** WPA1 WPA2 AP[2] wlan0-ap-2 Infra 1 54 Mbit/s 61 *** WPA1 WPA2
AP[3] wlan0-ap-2 Infra 1 54 Mbit/s 29 * WPA1 WPA2 AP[3] wlan0-ap-1 Infra 1 54 Mbit/s 29 * WPA1 WPA2
<<< <<<
stderr: 0 bytes stderr: 0 bytes

View File

@@ -4,9 +4,9 @@ lang: C
returncode: 0 returncode: 0
stdout: 165 bytes stdout: 165 bytes
>>> >>>
AP[1]: :wlan0-ap-3:Infra:1:54 Mbit/s:61:*** :WPA1 WPA2 AP[1]: :wlan0-ap-3:Infra:1:54 Mbit/s:88:****:WPA1 WPA2
AP[2]: :wlan0-ap-1:Infra:1:54 Mbit/s:34:** :WPA1 WPA2 AP[2]: :wlan0-ap-2:Infra:1:54 Mbit/s:61:*** :WPA1 WPA2
AP[3]: :wlan0-ap-2:Infra:1:54 Mbit/s:29:* :WPA1 WPA2 AP[3]: :wlan0-ap-1:Infra:1:54 Mbit/s:29:* :WPA1 WPA2
<<< <<<
stderr: 0 bytes stderr: 0 bytes

View File

@@ -9,19 +9,19 @@ AP[1].SSID: wlan0-ap-3
AP[1].MODE: Infrastruktura AP[1].MODE: Infrastruktura
AP[1].CHAN: 1 AP[1].CHAN: 1
AP[1].RATE: 54Mb/s AP[1].RATE: 54Mb/s
AP[1].SIGNAL: 61 AP[1].SIGNAL: 88
AP[1].BARS: *** AP[1].BARS: ****
AP[1].SECURITY: WPA1 WPA2 AP[1].SECURITY: WPA1 WPA2
AP[2].IN-USE: AP[2].IN-USE:
AP[2].SSID: wlan0-ap-1 AP[2].SSID: wlan0-ap-2
AP[2].MODE: Infrastruktura AP[2].MODE: Infrastruktura
AP[2].CHAN: 1 AP[2].CHAN: 1
AP[2].RATE: 54Mb/s AP[2].RATE: 54Mb/s
AP[2].SIGNAL: 34 AP[2].SIGNAL: 61
AP[2].BARS: ** AP[2].BARS: ***
AP[2].SECURITY: WPA1 WPA2 AP[2].SECURITY: WPA1 WPA2
AP[3].IN-USE: AP[3].IN-USE:
AP[3].SSID: wlan0-ap-2 AP[3].SSID: wlan0-ap-1
AP[3].MODE: Infrastruktura AP[3].MODE: Infrastruktura
AP[3].CHAN: 1 AP[3].CHAN: 1
AP[3].RATE: 54Mb/s AP[3].RATE: 54Mb/s

View File

@@ -12,21 +12,21 @@ AP[1].SSID: wlan0-ap-3
AP[1].MODE: Infrastruktura AP[1].MODE: Infrastruktura
AP[1].CHAN: 1 AP[1].CHAN: 1
AP[1].RATE: 54Mb/s AP[1].RATE: 54Mb/s
AP[1].SIGNAL: 61 AP[1].SIGNAL: 88
AP[1].BARS: *** AP[1].BARS: ****
AP[1].SECURITY: WPA1 WPA2 AP[1].SECURITY: WPA1 WPA2
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
AP[2].IN-USE: AP[2].IN-USE:
AP[2].SSID: wlan0-ap-1 AP[2].SSID: wlan0-ap-2
AP[2].MODE: Infrastruktura AP[2].MODE: Infrastruktura
AP[2].CHAN: 1 AP[2].CHAN: 1
AP[2].RATE: 54Mb/s AP[2].RATE: 54Mb/s
AP[2].SIGNAL: 34 AP[2].SIGNAL: 61
AP[2].BARS: ** AP[2].BARS: ***
AP[2].SECURITY: WPA1 WPA2 AP[2].SECURITY: WPA1 WPA2
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
AP[3].IN-USE: AP[3].IN-USE:
AP[3].SSID: wlan0-ap-2 AP[3].SSID: wlan0-ap-1
AP[3].MODE: Infrastruktura AP[3].MODE: Infrastruktura
AP[3].CHAN: 1 AP[3].CHAN: 1
AP[3].RATE: 54Mb/s AP[3].RATE: 54Mb/s

View File

@@ -9,19 +9,19 @@ AP[1].SSID:wlan0-ap-3
AP[1].MODE:Infrastruktura AP[1].MODE:Infrastruktura
AP[1].CHAN:1 AP[1].CHAN:1
AP[1].RATE:54Mb/s AP[1].RATE:54Mb/s
AP[1].SIGNAL:61 AP[1].SIGNAL:88
AP[1].BARS:*** AP[1].BARS:****
AP[1].SECURITY:WPA1 WPA2 AP[1].SECURITY:WPA1 WPA2
AP[2].IN-USE: AP[2].IN-USE:
AP[2].SSID:wlan0-ap-1 AP[2].SSID:wlan0-ap-2
AP[2].MODE:Infrastruktura AP[2].MODE:Infrastruktura
AP[2].CHAN:1 AP[2].CHAN:1
AP[2].RATE:54Mb/s AP[2].RATE:54Mb/s
AP[2].SIGNAL:34 AP[2].SIGNAL:61
AP[2].BARS:** AP[2].BARS:***
AP[2].SECURITY:WPA1 WPA2 AP[2].SECURITY:WPA1 WPA2
AP[3].IN-USE: AP[3].IN-USE:
AP[3].SSID:wlan0-ap-2 AP[3].SSID:wlan0-ap-1
AP[3].MODE:Infrastruktura AP[3].MODE:Infrastruktura
AP[3].CHAN:1 AP[3].CHAN:1
AP[3].RATE:54Mb/s AP[3].RATE:54Mb/s

View File

@@ -5,9 +5,9 @@ returncode: 0
stdout: 338 bytes stdout: 338 bytes
>>> >>>
NAME IN-USE SSID MODE CHAN RATE SIGNAL BARS SECURITY NAME IN-USE SSID MODE CHAN RATE SIGNAL BARS SECURITY
AP[1] wlan0-ap-3 Infrastruktura 1 54Mb/s 61 *** WPA1 WPA2 AP[1] wlan0-ap-3 Infrastruktura 1 54Mb/s 88 **** WPA1 WPA2
AP[2] wlan0-ap-1 Infrastruktura 1 54Mb/s 34 ** WPA1 WPA2 AP[2] wlan0-ap-2 Infrastruktura 1 54Mb/s 61 *** WPA1 WPA2
AP[3] wlan0-ap-2 Infrastruktura 1 54Mb/s 29 * WPA1 WPA2 AP[3] wlan0-ap-1 Infrastruktura 1 54Mb/s 29 * WPA1 WPA2
<<< <<<
stderr: 0 bytes stderr: 0 bytes

View File

@@ -9,9 +9,9 @@ stdout: 530 bytes
=================================== ===================================
NAME IN-USE SSID MODE CHAN RATE SIGNAL BARS SECURITY NAME IN-USE SSID MODE CHAN RATE SIGNAL BARS SECURITY
----------------------------------------------------------------------------------- -----------------------------------------------------------------------------------
AP[1] wlan0-ap-3 Infrastruktura 1 54Mb/s 61 *** WPA1 WPA2 AP[1] wlan0-ap-3 Infrastruktura 1 54Mb/s 88 **** WPA1 WPA2
AP[2] wlan0-ap-1 Infrastruktura 1 54Mb/s 34 ** WPA1 WPA2 AP[2] wlan0-ap-2 Infrastruktura 1 54Mb/s 61 *** WPA1 WPA2
AP[3] wlan0-ap-2 Infrastruktura 1 54Mb/s 29 * WPA1 WPA2 AP[3] wlan0-ap-1 Infrastruktura 1 54Mb/s 29 * WPA1 WPA2
<<< <<<
stderr: 0 bytes stderr: 0 bytes

View File

@@ -4,9 +4,9 @@ lang: pl_PL.UTF-8
returncode: 0 returncode: 0
stdout: 192 bytes stdout: 192 bytes
>>> >>>
AP[1]: :wlan0-ap-3:Infrastruktura:1:54Mb/s:61:*** :WPA1 WPA2 AP[1]: :wlan0-ap-3:Infrastruktura:1:54Mb/s:88:****:WPA1 WPA2
AP[2]: :wlan0-ap-1:Infrastruktura:1:54Mb/s:34:** :WPA1 WPA2 AP[2]: :wlan0-ap-2:Infrastruktura:1:54Mb/s:61:*** :WPA1 WPA2
AP[3]: :wlan0-ap-2:Infrastruktura:1:54Mb/s:29:* :WPA1 WPA2 AP[3]: :wlan0-ap-1:Infrastruktura:1:54Mb/s:29:* :WPA1 WPA2
<<< <<<
stderr: 0 bytes stderr: 0 bytes

View File

@@ -5,12 +5,12 @@ returncode: 0
stdout: 1840 bytes stdout: 1840 bytes
>>> >>>
NAME SSID SSID-HEX BSSID MODE CHAN FREQ RATE SIGNAL BARS SECURITY WPA-FLAGS RSN-FLAGS DEVICE ACTIVE IN-USE DBUS-PATH NAME SSID SSID-HEX BSSID MODE CHAN FREQ RATE SIGNAL BARS SECURITY WPA-FLAGS RSN-FLAGS DEVICE ACTIVE IN-USE DBUS-PATH
AP[1] wlan0-ap-3 776C616E302D61702D33 A1:A2:78:A7:C5:D5 Infra 1 2412 MHz 54 Mbit/s 61 *** WPA1 WPA2 pair_tkip pair_ccmp group_tkip group_ccmp psk pair_tkip pair_ccmp group_tkip group_ccmp psk wlan0 no /org/freedesktop/NetworkManager/AccessPoint/2 AP[1] wlan0-ap-3 776C616E302D61702D33 53:8C:FC:BD:7D:2B Infra 1 2412 MHz 54 Mbit/s 88 **** WPA1 WPA2 pair_tkip pair_ccmp group_tkip group_ccmp psk pair_tkip pair_ccmp group_tkip group_ccmp psk wlan0 no /org/freedesktop/NetworkManager/AccessPoint/3
AP[2] wlan0-ap-1 776C616E302D61702D31 EA:BF:C2:09:F9:F9 Infra 1 2412 MHz 54 Mbit/s 34 ** WPA1 WPA2 pair_tkip pair_ccmp group_tkip group_ccmp psk pair_tkip pair_ccmp group_tkip group_ccmp psk wlan0 no /org/freedesktop/NetworkManager/AccessPoint/0 AP[2] wlan0-ap-2 776C616E302D61702D32 A1:A2:78:A7:C5:D5 Infra 1 2412 MHz 54 Mbit/s 61 *** WPA1 WPA2 pair_tkip pair_ccmp group_tkip group_ccmp psk pair_tkip pair_ccmp group_tkip group_ccmp psk wlan0 no /org/freedesktop/NetworkManager/AccessPoint/2
AP[3] wlan0-ap-2 776C616E302D61702D32 81:28:C5:C2:E5:15 Infra 1 2412 MHz 54 Mbit/s 29 * WPA1 WPA2 pair_tkip pair_ccmp group_tkip group_ccmp psk pair_tkip pair_ccmp group_tkip group_ccmp psk wlan0 no /org/freedesktop/NetworkManager/AccessPoint/1 AP[3] wlan0-ap-1 776C616E302D61702D31 81:28:C5:C2:E5:15 Infra 1 2412 MHz 54 Mbit/s 29 * WPA1 WPA2 pair_tkip pair_ccmp group_tkip group_ccmp psk pair_tkip pair_ccmp group_tkip group_ccmp psk wlan0 no /org/freedesktop/NetworkManager/AccessPoint/1
NAME SSID SSID-HEX BSSID MODE CHAN FREQ RATE SIGNAL BARS SECURITY WPA-FLAGS RSN-FLAGS DEVICE ACTIVE IN-USE DBUS-PATH NAME SSID SSID-HEX BSSID MODE CHAN FREQ RATE SIGNAL BARS SECURITY WPA-FLAGS RSN-FLAGS DEVICE ACTIVE IN-USE DBUS-PATH
AP[1] wlan1-ap-4 776C616E312D61702D34 53:8C:FC:BD:7D:2B Infra 1 2412 MHz 54 Mbit/s 88 **** WPA1 WPA2 pair_tkip pair_ccmp group_tkip group_ccmp psk pair_tkip pair_ccmp group_tkip group_ccmp psk wlan1 no /org/freedesktop/NetworkManager/AccessPoint/3 AP[1] wlan1-ap-4 776C616E312D61702D34 EA:62:1C:BD:C0:8F Infra 1 2412 MHz 54 Mbit/s 34 ** WPA1 WPA2 pair_tkip pair_ccmp group_tkip group_ccmp psk pair_tkip pair_ccmp group_tkip group_ccmp psk wlan1 no /org/freedesktop/NetworkManager/AccessPoint/4
NAME SSID SSID-HEX BSSID MODE CHAN FREQ RATE SIGNAL BARS SECURITY WPA-FLAGS RSN-FLAGS DEVICE ACTIVE IN-USE DBUS-PATH NAME SSID SSID-HEX BSSID MODE CHAN FREQ RATE SIGNAL BARS SECURITY WPA-FLAGS RSN-FLAGS DEVICE ACTIVE IN-USE DBUS-PATH

File diff suppressed because it is too large Load Diff