Add DPI Restriction switch to UniFi integration (#42499)
* initial implementation for controlling DPI restrictions * address PR review comments and add DataUpdateCoordinator * fix existing tests against new lib version * add tests for DPI switches * bump aiounifi * listen to events instead of polling * fix tests * remove useless test * bump aiounifi * rename device to UniFi Controller per PR feedback
This commit is contained in:
parent
aab0ff2ea5
commit
5a4c1dbcc4
14 changed files with 309 additions and 42 deletions
|
@ -81,6 +81,8 @@ async def setup_unifi_integration(
|
|||
devices_response=None,
|
||||
clients_all_response=None,
|
||||
wlans_response=None,
|
||||
dpigroup_response=None,
|
||||
dpiapp_response=None,
|
||||
known_wireless_clients=None,
|
||||
controllers=None,
|
||||
):
|
||||
|
@ -116,6 +118,14 @@ async def setup_unifi_integration(
|
|||
if wlans_response:
|
||||
mock_wlans_responses.append(wlans_response)
|
||||
|
||||
mock_dpigroup_responses = deque()
|
||||
if dpigroup_response:
|
||||
mock_dpigroup_responses.append(dpigroup_response)
|
||||
|
||||
mock_dpiapp_responses = deque()
|
||||
if dpiapp_response:
|
||||
mock_dpiapp_responses.append(dpiapp_response)
|
||||
|
||||
mock_requests = []
|
||||
|
||||
async def mock_request(self, method, path, json=None):
|
||||
|
@ -129,6 +139,10 @@ async def setup_unifi_integration(
|
|||
return mock_client_all_responses.popleft()
|
||||
if path == "/rest/wlanconf" and mock_wlans_responses:
|
||||
return mock_wlans_responses.popleft()
|
||||
if path == "/rest/dpigroup" and mock_dpigroup_responses:
|
||||
return mock_dpigroup_responses.popleft()
|
||||
if path == "/rest/dpiapp" and mock_dpiapp_responses:
|
||||
return mock_dpiapp_responses.popleft()
|
||||
return {}
|
||||
|
||||
with patch("aiounifi.Controller.check_unifi_os", return_value=True), patch(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue