Commit Graph
75 Commits
Author SHA1 Message Date
Erik MontnemeryandGitHub f6682ba99d Block tests from opening sockets (#55516) 2021-10-05 14:46:09 -10:00
Erik MontnemeryandGitHub 8c5efafdd8 Add 5-minute statistics for sensors (#56006)
* Add 5-minute statistics for sensors

* Address pylint issues

* Black

* Apply suggestion from code review

* Apply suggestions from code review

* Improve tests
2021-09-16 10:57:15 +02:00
Erik MontnemeryandGitHub 7dbe8070f7 Mock out network.util.async_get_source_ip in tests (#55592) 2021-09-02 20:44:50 +02:00
Erik MontnemeryandGitHub cdaba62d2c Add test fixture for unauthenticated HTTP client (#55561)
* Add test fixture for unauthenticated HTTP client

* Remove things from the future
2021-09-02 13:09:16 +02:00
Erik MontnemeryandGitHub 7dbd0e5274 Fix zeroconf mock and use it in CI group 1's tests (#55526)
* Fix zeroconf mock and use it in CI group 1's tests

* Mock HaAsyncServiceBrowser
2021-09-01 22:38:00 +02:00
Erik MontnemeryandGitHub e541bcd54d Update statistics meta data on entity_id change (#52755) 2021-07-14 13:23:11 +02:00
Erik MontnemeryandGitHub e16a8063a5 Compile statistics for energy sensors (#50829)
* Compile statistics for energy sensors

* Update tests

* Rename abs_value to state

* Tweak

* Recreate statistics table

* Pylint

* Try to fix test

* Fix statistics for multiple energy sensors

* Fix energy statistics when last_reset is not set
2021-05-20 13:05:15 +02:00
J. Nick KostonandGitHub 909a20b36d Use async zeroconf registration functions (#50168) 2021-05-11 11:03:36 -05:00
Erik MontnemeryandGitHub ed31cc363b Wait for registries to load at startup (#46265)
* Wait for registries to load at startup

* Don't decorate new functions with @bind_hass

* Fix typing errors in zwave_js

* Load registries in async_test_home_assistant

* Tweak

* Typo

* Tweak

* Explicitly silence mypy errors

* Fix tests

* Fix more tests

* Fix test

* Improve docstring

* Wait for registries to load
2021-02-11 17:36:19 +01:00
Joakim PlateandGitHub d4f186078c During tests we can run with lowest rounds (#45710) 2021-01-29 19:57:14 +01:00
Joakim PlateandGitHub af68d5fb41 Use a fully mocked credential (#45707) 2021-01-29 17:58:25 +01:00
38d2cacf7a Support blocking trusted network from new ip (#44630)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-01-28 12:06:20 +01:00
Franck NijhofandGitHub 65cf2fcb6f Drop asynctest (#44746) 2021-01-01 22:31:56 +01:00
Erik MontnemeryandGitHub 5e6f5fca90 Don't send MQTT birth message in tests (#43917) 2020-12-04 04:39:49 +01:00
Paulus SchoutsenandGitHub ea55051161 Stub finding custom integrations in tests (#43692) 2020-11-27 12:53:16 +01:00
Paulus SchoutsenandGitHub f9fa24950b OAuth2 to use current request header (#43668) 2020-11-27 08:55:34 +01:00
Tom Parker-ShemiltandGitHub 2b151209b2 Don't try and store exceptions when the key is missing (#41803) 2020-10-16 10:01:58 +02:00
Erik MontnemeryandGitHub 392d5c673a Cache matching MQTT subscriptions (#41433) 2020-10-08 08:52:23 +02:00
J. Nick KostonandGitHub 9e1461da62 Determine how to run listeners at setup time instead of execution time (#41304) 2020-10-07 16:51:50 +02:00
06e9489fc7 Add Tasmota integration (#39624)
* Add Tasmota integration

* Refactor

* Add tests, small improvements

* isort

* Attempt to fix tests failing with Python 3.8

* Revert "Attempt to fix tests failing with Python 3.8"

This reverts commit 11454f8a00136f068ea27204183fa3e62f3cd263.

* Fix tests failing with Python 3.8

* Cleanup tests

* Address review comments

* Address review comments

* Address review comments

* Use MAC address for device identification

* Bump hatasmota

* Bump hatasmota

* Apply suggestions from code review

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Fix indentation

* Remove preparation for device remove WS API

* Address review comments

* Remove useless try-except

* Tweak

* Improve tests

* Tweak

* Address review comments

* Correct test

* Update manifest.json

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-10-06 14:51:58 +02:00
J. Nick KostonandGitHub 7b016063ca Refactor zeroconf setup to be async (#39955)
* Refactor zeroconf setup to be async

Most of the setup was calling back to async because
we were setting up listeners.  Since we only need
to jump into the executor to create the zeroconf
instance, its much faster to setup in async.

In testing this cut the setup time in half
or better.

* partial revert to after_deps
2020-09-13 18:06:19 -05:00
Erik MontnemeryandGitHub ee043d8614 Wait for broker to ACK MQTT operations (#39051)
* Wait for broker to ACK MQTT operations

* Deduplicate new code

* Fix tests

* Improve test

* Don't hold PAHO lock when waiting for ACK

* Fix tests

* Add constant for ACK timeout
2020-08-21 17:00:13 +02:00
Franck NijhofandGitHub 755761867d Use current request context in OAuth redirect (#38692) 2020-08-15 15:26:54 +02:00
J. Nick KostonandGitHub 60009ec2f9 Use event loop scheduling for tracking time patterns (#38021)
* Use event loop scheduling for tracking time patterns

* make patching of time targetable

* patch time tests since time can tick to match during the test

* fix more tests

* time can only move forward

* time can only move forward

* back to 100% coverage

* simplify since the event loop time cannot move backwards

* simplify some more

* revert simplify

* Revert "revert simplify"

This reverts commit bd42f232f6.

* Revert "simplify some more"

This reverts commit 2a6c57d514.

* Revert "simplify since the event loop time cannot move backwards"

This reverts commit 3b13714ef4.

* Attempt another simplify

* time does not move backwards in the last two

* remove next_time <= now check

* fix previous merge error
2020-07-20 20:18:31 -10:00
bcd604eec2 Detect lingering threads after tests (#37270)
* Detect lingering threads after tests

* Make sure cast is setup before checking state

* Make sure we ask executors of old hass to shutdown

We are not waiting here, just hoping for the best

* Make sure all instances of hass and executors is stopped.

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>

* Also apply hass stopping to scripts

* Adjust to changes how we set up executor

* Add new CoreState.stopped

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2020-07-09 16:15:14 +02:00
f49ce5d1b4 Protect loop set default executor (#37438)
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-07-06 15:58:53 -07:00
89a9634d35 Use eventloop for scheduling (#37184)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2020-06-29 09:39:24 -07:00
Erik MontnemeryandGitHub 747490ab34 Support reconfiguring MQTT config entry (#36537) 2020-06-22 17:49:01 -07:00
Erik MontnemeryandGitHub 280f49540e Drop use of async_mock_mqtt_component (#37011) 2020-06-22 23:59:50 +02:00
Erik MontnemeryandGitHub f1ecac92df Fail tests if wrapped callbacks or coroutines throw (#35010) 2020-05-06 14:14:57 -07:00
Paulus SchoutsenandGitHub ec47216388 Use built-in test helpers on 3.8 (#34901) 2020-04-30 13:29:50 -07:00
Paulus SchoutsenandGitHub 0d700f6a63 Fix tests for Python 3.8 (#34672) 2020-04-25 14:32:55 -07:00
ZivandGitHub 1259979204 Fix uncaught exception in local_file (#34312)
* remove ignore from localfile

* added mock_registry

* since there are no more exceptions, infra to ignore them is redundant
2020-04-17 13:10:48 +02:00
Paulus SchoutsenandGitHub bea354b82a Allow WS queue to temporarily peak (#34175)
* Allow WS queue to temporarily peak

* Remove unused code
2020-04-13 18:50:36 -07:00
David F. MulcaheyandGitHub 8b0a0ee521 Don't write storage to disk while stopping (#33456)
* Don't write storage to disk while stopping

* rework change

* lint

* remove delay save and schedule final write at stop

* update tests

* fix test component using private methods

* cleanup

* always listen

* use stop in restore state again

* whitelist JSON exceptions for later

* review comment

* make zwave tests use mock storage
2020-04-02 10:25:28 -07:00
ZivandGitHub ff391e538a Fail tests with uncaught exceptions (#33312)
* initial implementation and ignore file

* updated ignore list for the tests in the most recent dev branch
2020-03-27 21:36:06 -07:00
Martin HjelmareandGitHub e3adbc336d Fix check_real location guard (#31890) 2020-02-16 15:33:09 -08:00
Ville SkyttäandGitHub 5216477353 Be consistent with Home Assistant and Hass.io spelling (#30500)
* Be consistent with Home Assistant spelling

* Be consistent with Hass.io spelling
2020-01-05 14:09:17 +02:00
Paulus SchoutsenandGitHub b9aba30a6e Extract Collection helper from Person integration (#30313)
* Add CRUD foundation

* Use collection helper in person integration

* Lint/pytest

* Add tests

* Lint

* Create notification
2020-01-03 21:37:11 +01:00
Ville SkyttäandPaulus Schoutsen fa4fa30461 Various string cleanups (#30435)
* Remove some unnecessary string concatenations

* Replace some simple str.formats with f-strings

* Replace some string concatenations with f-strings
2020-01-03 14:47:06 +01:00
Ville SkyttäandGitHub e6388e186c Remove unnecessary string literal concatenations (#30360) 2020-01-02 21:17:10 +02:00
Pascal VizeliandGitHub 0c796fc3c3 Remove uvloop event policy (#29835)
* Remove uvloop event policy

* Clean tests

* Fix lint

* Cleanup statment
2019-12-11 13:28:50 +01:00
Bas NijholtandFranck Nijhof 897522a82d Fix 'pytest.register_assert_rewrite("tests.common")' warning (#29797)
see https://github.com/home-assistant/home-assistant/pull/29791/files/fea243c035f117275fda1895720d30e7f977aa9c#r355533273
2019-12-09 19:04:38 +01:00
Bas NijholtandFranck Nijhof f60125b5c9 Sort imports according to PEP8 for 'tests' (#29791) 2019-12-09 16:52:24 +01:00
Erik MontnemeryandGitHub 3e99743244 Add device trigger support to sensor entities (#27133)
* Add device trigger support to sensor entities

* Fix typing

* Fix tests, add test helper for comparing lists
2019-10-03 06:14:35 +02:00
Paulus Schoutsen 4de97abc3a Black 2019-07-31 12:25:30 -07:00
Paulus SchoutsenandGitHub 9e96397e6a Require core config detection to be triggerd manually (#24019)
* Detect core config

* Remove elevation

* Lint

* Lint

* Fix type
2019-05-22 17:24:46 -07:00
Paulus SchoutsenandGitHub 70ed58a78d Restructure device tracker (#23862)
* Restructure device tracker

* Docstyle

* Fix typing

* Lint

* Lint

* Fix tests
2019-05-15 23:43:45 +02:00
Paulus SchoutsenandGitHub cc13713abd No longer rely on requests (#23685)
* No longer rely on requests

* Lint

* Missed a few parts

* Fix types

* Fix more types

* Update __main__.py

* Fix tests

* Lint

* Fix script
2019-05-08 11:15:04 -07:00
Jason HuandPaulus Schoutsen fe1840f901 Deprecate http.api_password (#21884)
* Deprecated http.api_password

* Deprecated ApiConfig.api_password

GitHub Drafted PR would trigger CI after changed it to normal PR.
I have to commit a comment change to trigger it

* Trigger CI

* Adjust if- elif chain in auth middleware
2019-03-10 19:55:36 -07:00