Skip to content

Commit 55b8e5e

Browse files
authored
Merge pull request #67 from ushiboy/release/1.3.0
Release 1.3.0
2 parents 2ec518e + b1a2eaf commit 55b8e5e

File tree

6 files changed

+30
-8
lines changed

6 files changed

+30
-8
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ nmcli.device.delete(ifname: str, wait: int = None) -> None
249249
List available Wi-Fi access points.
250250

251251
```
252-
nmcli.device.wifi(ifname: str = None) -> List[DeviceWifi]
252+
nmcli.device.wifi(ifname: str = None, rescan: bool = None) -> List[DeviceWifi]
253253
```
254254

255255
#### nmcli.device.wifi_connect
@@ -459,6 +459,10 @@ nmcli.set_lang(lang: str) -> None
459459

460460
## Change Log
461461

462+
### 1.3.0
463+
464+
- Added rescan parameter to `nmcli.device.wifi`.
465+
462466
### 1.2.0
463467

464468
- Added support for encodings other than UTF-8.

nmcli/_device.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def reapply(self, ifname: str) -> None:
6060
def delete(self, ifname: str, wait: int = None) -> None:
6161
raise NotImplementedError
6262

63-
def wifi(self, ifname: str = None) -> List[DeviceWifi]:
63+
def wifi(self, ifname: str = None, rescan: bool = None) -> List[DeviceWifi]:
6464
raise NotImplementedError
6565

6666
def wifi_connect(self,

nmcli/dummy/_device.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def __init__(self,
6161
self._disconnect_args: List[Tuple] = []
6262
self._reapply_args: List[str] = []
6363
self._delete_args: List[Tuple] = []
64-
self._wifi_args: List[str] = []
64+
self._wifi_args: List[Tuple] = []
6565
self._wifi_connect_args: List[Tuple] = []
6666
self._wifi_hotspot_args: List[Tuple] = []
6767
self._wifi_rescan_args: List[Tuple] = []
@@ -101,10 +101,9 @@ def delete(self, ifname: str, wait: int = None) -> None:
101101
self._raise_error_if_needed()
102102
self._delete_args.append((ifname, wait))
103103

104-
def wifi(self, ifname: str = None) -> List[DeviceWifi]:
104+
def wifi(self, ifname: str = None, rescan: bool = None) -> List[DeviceWifi]:
105105
self._raise_error_if_needed()
106-
if ifname is not None:
107-
self._wifi_args.append(ifname)
106+
self._wifi_args.append((ifname, rescan))
108107
return self._result_wifi
109108

110109
def wifi_connect(self,

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def run_tests(self):
1313

1414
setup(
1515
name='nmcli',
16-
version='1.2.0',
16+
version='1.3.0',
1717
author='ushiboy',
1818
license='MIT',
1919
license_files = ('LICENSE.txt',),

tests/dummy/test_device.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,11 @@ def test_wifi():
123123
assert c.wifi() == result_wifi
124124
ifname = 'wlan0'
125125
assert c.wifi(ifname) == result_wifi
126-
assert c.wifi_args == [ifname]
126+
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)]
127131

128132

129133
def test_wifi_when_raise_error():

tests/test_device.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,21 @@ def test_device_wifi():
252252
'IN-USE,SSID,BSSID,MODE,CHAN,FREQ,RATE,SIGNAL,SECURITY',
253253
'device', 'wifi', 'list', 'ifname', ifname]
254254

255+
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+
assert s2.passed_parameters == ['-t', '-f',
262+
'IN-USE,SSID,BSSID,MODE,CHAN,FREQ,RATE,SIGNAL,SECURITY',
263+
'device', 'wifi', 'list', '--rescan', "no"]
264+
265+
device.wifi(ifname, rescan=True)
266+
assert s2.passed_parameters == ['-t', '-f',
267+
'IN-USE,SSID,BSSID,MODE,CHAN,FREQ,RATE,SIGNAL,SECURITY',
268+
'device', 'wifi', 'list', 'ifname', ifname, '--rescan', "yes"]
269+
255270

256271
def test_wifi_connect():
257272
s = DummySystemCommand()

0 commit comments

Comments
 (0)