Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump aiounifi to v66 #104336

Merged
merged 1 commit into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion homeassistant/components/unifi/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"iot_class": "local_push",
"loggers": ["aiounifi"],
"quality_scale": "platinum",
"requirements": ["aiounifi==65"],
"requirements": ["aiounifi==66"],
"ssdp": [
{
"manufacturer": "Ubiquiti Networks",
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ aiosyncthing==0.5.1
aiotractive==0.5.6

# homeassistant.components.unifi
aiounifi==65
aiounifi==66

# homeassistant.components.vlc_telnet
aiovlc==0.1.0
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ aiosyncthing==0.5.1
aiotractive==0.5.6

# homeassistant.components.unifi
aiounifi==65
aiounifi==66

# homeassistant.components.vlc_telnet
aiovlc==0.1.0
Expand Down
5 changes: 5 additions & 0 deletions tests/components/unifi/test_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@ def mock_default_unifi_requests(
json={"data": wlans_response or [], "meta": {"rc": "ok"}},
headers={"content-type": CONTENT_TYPE_JSON},
)
aioclient_mock.get(
f"https://{host}:1234/v2/api/site/{site_id}/trafficroutes",
json=[{}],
headers={"content-type": CONTENT_TYPE_JSON},
)
aioclient_mock.get(
f"https://{host}:1234/v2/api/site/{site_id}/trafficrules",
json=[{}],
Expand Down
30 changes: 15 additions & 15 deletions tests/components/unifi/test_switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,6 @@ async def test_no_clients(
},
)

assert aioclient_mock.call_count == 12
assert len(hass.states.async_entity_ids(SWITCH_DOMAIN)) == 0


Expand Down Expand Up @@ -852,31 +851,31 @@ async def test_switches(
assert ent_reg.async_get(entry_id).entity_category is EntityCategory.CONFIG

# Block and unblock client

aioclient_mock.clear_requests()
aioclient_mock.post(
f"https://{controller.host}:1234/api/s/{controller.site}/cmd/stamgr",
)

await hass.services.async_call(
SWITCH_DOMAIN, "turn_off", {"entity_id": "switch.block_client_1"}, blocking=True
)
assert aioclient_mock.call_count == 13
assert aioclient_mock.mock_calls[12][2] == {
assert aioclient_mock.call_count == 1
assert aioclient_mock.mock_calls[0][2] == {
"mac": "00:00:00:00:01:01",
"cmd": "block-sta",
}

await hass.services.async_call(
SWITCH_DOMAIN, "turn_on", {"entity_id": "switch.block_client_1"}, blocking=True
)
assert aioclient_mock.call_count == 14
assert aioclient_mock.mock_calls[13][2] == {
assert aioclient_mock.call_count == 2
assert aioclient_mock.mock_calls[1][2] == {
"mac": "00:00:00:00:01:01",
"cmd": "unblock-sta",
}

# Enable and disable DPI

aioclient_mock.clear_requests()
aioclient_mock.put(
f"https://{controller.host}:1234/api/s/{controller.site}/rest/dpiapp/5f976f62e3c58f018ec7e17d",
)
Expand All @@ -887,17 +886,17 @@ async def test_switches(
{"entity_id": "switch.block_media_streaming"},
blocking=True,
)
assert aioclient_mock.call_count == 15
assert aioclient_mock.mock_calls[14][2] == {"enabled": False}
assert aioclient_mock.call_count == 1
assert aioclient_mock.mock_calls[0][2] == {"enabled": False}

await hass.services.async_call(
SWITCH_DOMAIN,
"turn_on",
{"entity_id": "switch.block_media_streaming"},
blocking=True,
)
assert aioclient_mock.call_count == 16
assert aioclient_mock.mock_calls[15][2] == {"enabled": True}
assert aioclient_mock.call_count == 2
assert aioclient_mock.mock_calls[1][2] == {"enabled": True}


async def test_remove_switches(
Expand Down Expand Up @@ -976,24 +975,25 @@ async def test_block_switches(
assert blocked is not None
assert blocked.state == "off"

aioclient_mock.clear_requests()
aioclient_mock.post(
f"https://{controller.host}:1234/api/s/{controller.site}/cmd/stamgr",
)

await hass.services.async_call(
SWITCH_DOMAIN, "turn_off", {"entity_id": "switch.block_client_1"}, blocking=True
)
assert aioclient_mock.call_count == 13
assert aioclient_mock.mock_calls[12][2] == {
assert aioclient_mock.call_count == 1
assert aioclient_mock.mock_calls[0][2] == {
"mac": "00:00:00:00:01:01",
"cmd": "block-sta",
}

await hass.services.async_call(
SWITCH_DOMAIN, "turn_on", {"entity_id": "switch.block_client_1"}, blocking=True
)
assert aioclient_mock.call_count == 14
assert aioclient_mock.mock_calls[13][2] == {
assert aioclient_mock.call_count == 2
assert aioclient_mock.mock_calls[1][2] == {
"mac": "00:00:00:00:01:01",
"cmd": "unblock-sta",
}
Expand Down