Commit graph

274 commits

Author SHA1 Message Date
Robert Svensson
5eff4f9816
Unifi improve fixture typing (#122864)
* Improve typing of UniFi fixtures

* Improve fixture typing, excluding image, sensor, switch

* Improve fixture typing in image tests

* Improve fixtures typing in sensor tests

* Improve fixture typing in switch tests

* Fix review comment
2024-07-30 19:33:25 +02:00
bdowden
18a7d15d14
Add Traffic Rule switches to UniFi Network (#118821)
* Add Traffic Rule switches to UniFi Network

* Retrieve Fix unifi traffic rule switches

Poll for traffic rule updates; have immediate feedback in the UI for modifying traffic rules

* Remove default values for unifi entity; Remove unnecessary code

* Begin updating traffic rule unit tests

* For the mock get request, allow for meta and data properties to not be appended to support v2 api requests

Fix traffic rule unit tests;

* inspect path to determine json response instead of passing an argument

* Remove entity id parameter from tests; remove unused code; rename traffic rule unique ID prefix

* Remove parameter with default.

* More code removal;

* Rename copy/paste variable; remove commented code; remove duplicate default code

---------

Co-authored-by: ViViDboarder <ViViDboarder@gmail.com>
2024-07-30 17:26:08 +02:00
Kim de Vos
896cd27bea
Add sensors for Unifi latency (#116737)
* Add sensors for Unifi latency

* Add needed guard and casting

* Use new types

* Add WAN2 support

* Add literals

* Make ids for WAN and WAN2 unique

* Make methods general

* Update sensor.py

* add more typing

* Simplify usage make_wan_latency_sensors

* Simplify further

* Move latency entity creation to method

* Make method internal

* simplify tests

* Apply feedback

* Reduce boiler copied code and add support function

* Add external method for share logic between

* Remove none

* Add more tests

* Apply feedback and change code to improve code coverage
2024-07-30 17:20:56 +02:00
Robert Resch
ad50136dbd
Add created_at/modified_at to config entries (#122456) 2024-07-29 22:08:46 +02:00
Robert Svensson
53131390ac
Use snapshot in UniFi image tests (#122608)
* Use snapshot in UniFi image tests

* Make Image access_token deterministic
2024-07-26 19:22:09 +02:00
Robert Svensson
33ea67e1d0
Remove last references to hass.data[UNIFI_DOMAIN] (#122642) 2024-07-26 12:29:21 +02:00
Robert Svensson
51d5e21203
Remove unused fixtures in UniFi tests (#122628) 2024-07-26 09:48:12 +02:00
Robert Svensson
e015c0a6ae
Use snapshot in UniFi device tracker tests (#122603) 2024-07-25 18:16:58 +02:00
Robert Svensson
81c8ba87ab
Use snapshot in UniFi button tests (#122602) 2024-07-25 18:16:25 +02:00
Robert Svensson
08d7beb803
Use snapshots in UniFi update tests (#122599) 2024-07-25 17:32:31 +02:00
Marc Mueller
8e024ad20f
Fix invalid Any annotations (#122212) 2024-07-20 02:46:27 +02:00
Marc Mueller
281c66b6c2
Fix invalid dict annotations in tests (#122178) 2024-07-19 14:45:42 +02:00
Robert Svensson
aeabe3ab95
Mark UniFi power cycle button as unavailable if PoE is not enabled on port (#122035) 2024-07-16 20:16:36 +02:00
Robert Svensson
61111f5d71
Fix bad access to UniFi runtime_data when not assigned (#121725)
* Fix bad access to runtime_data when not assigned

* Fix review comment

* Clean up if statements
2024-07-10 23:53:11 +02:00
Marc Mueller
f11b316dac
Import Generator from collections.abc (4) (#120917) 2024-07-01 11:54:42 +02:00
Richard Kroegel
f672eec515
Fix unifi device tracker test imports (#120864) 2024-06-30 16:27:03 +02:00
Robert Svensson
8b3319b772
Improve UniFi device tracker tests (#120795) 2024-06-30 15:26:45 +02:00
Robert Svensson
289a630578
Improve UniFi device tracker tests Pt2 (#120796) 2024-06-30 15:25:38 +02:00
Robert Svensson
e961ddd5fe
Simplify UniFi uptime sensor test (#120794) 2024-06-30 15:22:15 +02:00
wittypluck
3549aaf69c
Reject small uptime updates for Unifi clients (#120398)
Extend logic to reject small uptime updates to Unifi clients + add unit tests
2024-06-28 22:47:20 +02:00
Robert Svensson
ed7a888c07
Add one UniFi sensor test to validate entity attributes (#119914) 2024-06-21 12:59:31 +02:00
Robert Svensson
6ddc872655
Improve UniFi device tracker client tests (#119982) 2024-06-21 12:20:13 +02:00
Robert Svensson
6fb5a12ef1
Make UniFi services handle unloaded config entry (#120028) 2024-06-21 10:36:52 +02:00
Robert Svensson
49349de74e
Unifi break out switch availability test to separate test (#119990) 2024-06-19 22:40:13 +02:00
Robert Svensson
970836da0c
Clean up config option tests in UniFi device tracker tests (#119978) 2024-06-19 19:42:23 +02:00
epenet
3e9d25f81d
Add missing argument type hints to component tests (#119671) 2024-06-14 09:26:46 +02:00
Robert Svensson
707e422a31
Add UniFi sensor for number of clients connected to a device (#119509)
Co-authored-by: Kim de Vos <kim.de.vos@vippsmobilepay.com>
2024-06-12 18:20:31 +02:00
Robert Svensson
325352e197
Fixture cleanup in UniFi tests (#119227)
* Make sure all mock_device_registry are used with usefixtuers

* Make sure to use name with fixtures and rename functions to start with fixture_

* Streamline config_entry_setup

* Type all *_payload

* Mark @pytest.mark.usefixtures("mock_default_requests")

* Clean up unnecessary newlines after docstring
2024-06-09 16:07:36 -04:00
Robert Svensson
c9911e4dd4
Rework UniFi tests to not use runtime data (#119202) 2024-06-09 15:56:26 +02:00
Robert Svensson
ff493a8a9d
Rewrite the UniFi button entity tests (#118771) 2024-06-09 12:25:06 +02:00
Robert Svensson
d6097573f5
Remove old UniFi test infrastructure (#119160)
Clean up hub
2024-06-08 16:44:24 -04:00
Robert Svensson
915658daa1
Fix failing UniFi tests related to utcnow (#119131)
* test

* Fix missed test
2024-06-08 17:58:47 +02:00
Robert Svensson
20df747806
Use fixtures in UniFi device tracker tests (#118912) 2024-06-07 21:28:02 +02:00
Robert Svensson
a8becb1248
Use fixtures in UniFi sensor tests (#118921) 2024-06-07 12:15:03 +02:00
Robert Svensson
ec3a976410
Use fixtures in UniFi image tests (#118887) 2024-06-06 14:23:10 -04:00
Robert Svensson
d695660164
Use fixtures in UniFi diagnostics tests (#118905) 2024-06-06 14:22:41 -04:00
Robert Svensson
862c04a4b6
Use fixtures in UniFi service tests (#118838)
* Use fixtures in UniFi service tests

* Fix comments
2024-06-05 17:04:28 +02:00
Robert Svensson
b4f6325278
Use fixtures in UniFi switch tests (#118831) 2024-06-04 21:01:03 +02:00
Robert Svensson
c2e245f9d4
Use fixtures in UniFi update tests (#118818) 2024-06-04 21:00:50 +02:00
epenet
20b5aa3e0e
Move entity_registry_enabled_by_default to decorator [q-z] (#118793) 2024-06-04 13:38:32 +02:00
Robert Svensson
3232fd0eaf
Improve UniFi config flow tests (#118587)
* Use proper fixtures in config flow tests

* Improve rest of config flow tests

* Small improvement

* Rename fixtures
2024-06-01 00:27:53 +02:00
Robert Svensson
a7938091bf
Use fixtures to setup UniFi config entries (#118126) 2024-05-26 16:30:22 +02:00
Robert Svensson
fa815234be
Make UniFi use runtime data (#117457) 2024-05-14 21:04:26 +02:00
Erik Montnemery
90a50c162d
Use MockConfigEntry in unifi tests (#117238) 2024-05-11 11:11:53 +02:00
wittypluck
7a10959e58
Use websocket client to test device removal in Unifi (#116309)
* Use websocket client to test device removal from registry

* Rename client to ws_client to avoid confusion with Unifi clients

* Use remove_device helper
2024-05-01 08:46:03 +02:00
Kim de Vos
b69f589c30
Add bandwidth sensor for unifi device ports (#115362) 2024-04-22 22:39:46 +02:00
Robert Svensson
83370a5bde
Remove sensor exposing UniFi WLAN password (#115929) 2024-04-21 20:27:44 +02:00
wittypluck
1c0c0bb0bc
Allow manual delete of stale Unifi device from UI (#115267)
* Allow manual delete of stale device from UI

* Add unit tests for remove_config_entry_device
2024-04-21 11:08:39 +02:00
Kim de Vos
f23e48f373
Add sensor for CPU and memory utilization for unifi device (#114986)
Add system stats to unifi device sensors
2024-04-08 19:29:54 +02:00
Joost Lekkerkerker
f3ba713289
Use FlowResultType enum in config flow tests N-Z (#114682)
Use FlowResultType enum in config flow tests
2024-04-03 09:53:20 +02:00