Commit Graph

30 Commits (a419fde0ebe8a8b5dd0655818b18951373c97ff4)

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
Robert Svensson 51d5e21203
Remove unused fixtures in UniFi tests (#122628) 2024-07-26 09:48:12 +02:00
Marc Mueller f11b316dac
Import Generator from collections.abc (4) (#120917) 2024-07-01 11:54:42 +02:00
epenet 3e9d25f81d
Add missing argument type hints to component tests (#119671) 2024-06-14 09:26:46 +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 d6097573f5
Remove old UniFi test infrastructure (#119160)
Clean up hub
2024-06-08 16:44:24 -04:00
Robert Svensson 20df747806
Use fixtures in UniFi device tracker tests (#118912) 2024-06-07 21:28:02 +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
Marc Mueller 87165c0d6e
Add empty line after module docstring [tests t-z] (#112712) 2024-03-08 14:44:56 +01:00
Robert Svensson 7c9891fff9
Break out UniFi config handling to own class (#111325) 2024-03-05 21:36:26 +01:00
Robert Svensson efc89cd34f
Unifi websocket manager (#111041)
* Move hub into .hub.hub

* Move websocket to own module

* Minor shuffle
2024-02-24 16:20:59 -05:00
Robert Svensson 2f026ca963
Unifi rename controller to hub (#110976)
* Rename controller.py to hub.py

* Rename UniFiController to UnifiHub

* Rename controller instances into hub

* Rename controller to hub in tests

* Rename aiounifi Controller references to api

* Update strings

* Rename test_controller test_hub

* Narrow scope of test_remove_sensors
2024-02-20 08:51:22 +01:00
Jan-Philipp Benecke 22e62f42e6
Use entity & device registry fixtures in unifi tests (#110889) 2024-02-18 23:47:10 +01:00
J. Nick Koston fb62b6f01e
Fix unifi test_tracked_clients test (#108638)
Fix unifi test_tracked_clients client

This test relied on the sensor platform getting set up and creating
the device before the device_tracker platform was setup since the
device_tracker platform will disable the entity because there is
not matching device entry for it via

4ee6735cbb/homeassistant/components/device_tracker/config_entry.py (L336)

There is no guarantee the sensor platform will get set up before
the device tracker platform so the test was subject to a race
where it would fail if the device tracker platform was setup first
2024-01-22 08:35:24 +01:00
Robert Svensson 01b5854968
Rework UniFi websocket (#100614)
* Rework websocket management

* remove unnecessary fixture

* Remove controller from mock_unifi_websocket

* Mock api.login in reconnect method

* Remove unnecessary edits

* Minor clean up

* Bump aiounifi to v63

* Wait on task cancellation
2023-09-27 10:56:24 +02:00
Erik Montnemery 05ac67eba2
Adjust unifi tests which create devices (#98211) 2023-08-10 18:24:42 +02:00
Robert Svensson 92eaa539b6
Simplify mocking UniFi websocket (#80652)
* Simplify mocking UniFi websocket

* Fix one more
2022-10-20 19:37:13 +02:00
Robert Svensson d0ed4b1ff2
Replace constants with enums in UniFi (#80637)
Replace constants with enums
Fix bad imports
2022-10-20 00:10:01 +03:00
epenet f33151ff8b
Adjust config-flow type hints in unifi (#72411)
* Adjust config-flow type hints in unifi

* Use mapping

* Use mapping

* Fix tests

* Fix tests

* Revert "Use mapping"

This reverts commit 126fedc848.
2022-05-24 21:42:11 +02:00
Paulus Schoutsen 2b4bb49eb7
Make device tracker entities work better (#63328)
Co-authored-by: Franck Nijhof <git@frenck.dev>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-01-04 23:16:43 -08:00
Christopher Bailey 5a72c9f7c3
Rename various usages of UniFi to better identify only UniFi Network (#59568)
* Renames various usages of UniFi to better indentify only UniFi Network

* Apply suggestions from code review

Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>

* Missed renames

* Updates more locations

* Removes instances of application/controller

* Missed a spot

* Updates all UniFi Controller instances

* Fixes typo

* Reverts changes to translations

Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
2021-11-26 22:44:49 +01:00
Marc Mueller 54d1e9985f
Update typing 15 (#48079) 2021-03-18 15:13:22 +01:00
Robert Svensson 793929f2ea
Increase test coverage of UniFi integration (#46347)
* Increase coverage of init

* Increase coverage of config_flow

* Improve coverage of controller

* Minor improvement to switch test

* Fix review comment

* Mock websocket class

* Replace the rest of the old websocket event tests

* Improve websocket fixture for cleaner tests

* Fix typing

* Improve connection state signalling based on Martins feedback

* Improve tests of reconnection_mechanisms based on Martins review comments

* Fix unload entry

* Fix isort issue after rebase

* Fix martins comment on not using caplog

* Fix wireless clients test

* Fix martins comments on wireless clients test
2021-03-05 21:28:41 +01:00
Franck Nijhof 65cf2fcb6f
Drop asynctest (#44746) 2021-01-01 22:31:56 +01:00
Paulus Schoutsen ec47216388
Use built-in test helpers on 3.8 (#34901) 2020-04-30 13:29:50 -07:00
Robert Svensson a8374cf423
UniFi - Try to discover local controller (#31326)
* Its working

* Use "unifi" as default host if a controller can be found

* Fix tests

* Make a fixture of patching the discovery function
2020-01-30 23:06:43 +01:00