We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 2ec518e + b1a2eaf commit 55b8e5eCopy full SHA for 55b8e5e
README.md
@@ -249,7 +249,7 @@ nmcli.device.delete(ifname: str, wait: int = None) -> None
249
List available Wi-Fi access points.
250
251
```
252
-nmcli.device.wifi(ifname: str = None) -> List[DeviceWifi]
+nmcli.device.wifi(ifname: str = None, rescan: bool = None) -> List[DeviceWifi]
253
254
255
#### nmcli.device.wifi_connect
@@ -459,6 +459,10 @@ nmcli.set_lang(lang: str) -> None
459
460
## Change Log
461
462
+### 1.3.0
463
+
464
+- Added rescan parameter to `nmcli.device.wifi`.
465
466
### 1.2.0
467
468
- Added support for encodings other than UTF-8.
nmcli/_device.py
@@ -60,7 +60,7 @@ def reapply(self, ifname: str) -> None:
60
def delete(self, ifname: str, wait: int = None) -> None:
61
raise NotImplementedError
62
63
- def wifi(self, ifname: str = None) -> List[DeviceWifi]:
+ def wifi(self, ifname: str = None, rescan: bool = None) -> List[DeviceWifi]:
64
65
66
def wifi_connect(self,
nmcli/dummy/_device.py
@@ -61,7 +61,7 @@ def __init__(self,
self._disconnect_args: List[Tuple] = []
self._reapply_args: List[str] = []
self._delete_args: List[Tuple] = []
- self._wifi_args: List[str] = []
+ self._wifi_args: List[Tuple] = []
self._wifi_connect_args: List[Tuple] = []
self._wifi_hotspot_args: List[Tuple] = []
67
self._wifi_rescan_args: List[Tuple] = []
@@ -101,10 +101,9 @@ def delete(self, ifname: str, wait: int = None) -> None:
101
self._raise_error_if_needed()
102
self._delete_args.append((ifname, wait))
103
104
105
106
- if ifname is not None:
107
- self._wifi_args.append(ifname)
+ self._wifi_args.append((ifname, rescan))
108
return self._result_wifi
109
110
setup.py
@@ -13,7 +13,7 @@ def run_tests(self):
13
14
setup(
15
name='nmcli',
16
- version='1.2.0',
+ version='1.3.0',
17
author='ushiboy',
18
license='MIT',
19
license_files = ('LICENSE.txt',),
tests/dummy/test_device.py
@@ -123,7 +123,11 @@ def test_wifi():
123
assert c.wifi() == result_wifi
124
ifname = 'wlan0'
125
assert c.wifi(ifname) == result_wifi
126
- assert c.wifi_args == [ifname]
+ assert c.wifi(rescan=True) == result_wifi
127
+ assert c.wifi(rescan=False) == result_wifi
128
+ assert c.wifi(ifname, rescan=True) == result_wifi
129
+ assert c.wifi_args == [(None, None), (ifname, None),
130
+ (None, True), (None, False), (ifname, True)]
131
132
133
def test_wifi_when_raise_error():
tests/test_device.py
@@ -252,6 +252,21 @@ def test_device_wifi():
'IN-USE,SSID,BSSID,MODE,CHAN,FREQ,RATE,SIGNAL,SECURITY',
'device', 'wifi', 'list', 'ifname', ifname]
+ device.wifi(rescan=True)
256
+ assert s2.passed_parameters == ['-t', '-f',
257
+ 'IN-USE,SSID,BSSID,MODE,CHAN,FREQ,RATE,SIGNAL,SECURITY',
258
+ 'device', 'wifi', 'list', '--rescan', "yes"]
259
260
+ device.wifi(rescan=False)
261
262
263
+ 'device', 'wifi', 'list', '--rescan', "no"]
264
265
+ device.wifi(ifname, rescan=True)
266
267
268
+ 'device', 'wifi', 'list', 'ifname', ifname, '--rescan', "yes"]
269
270
271
def test_wifi_connect():
272
s = DummySystemCommand()
0 commit comments