From 497a10ed65e408df561d7d2bff476642f991e697 Mon Sep 17 00:00:00 2001 From: Tom Date: Thu, 11 Mar 2021 12:49:41 +0100 Subject: [PATCH] Document more explicit the config_flow requirements for integrations (#845) Co-authored-by: Paulus Schoutsen Co-authored-by: Martin Hjelmare --- docs/config_entries_config_flow_handler.md | 4 ++++ docs/development_checklist.md | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/config_entries_config_flow_handler.md b/docs/config_entries_config_flow_handler.md index 5d2c9d89..19c776a4 100644 --- a/docs/config_entries_config_flow_handler.md +++ b/docs/config_entries_config_flow_handler.md @@ -311,3 +311,7 @@ See [Translations](#translations) local development instructions. Authentication failures (such as a revoked oauth token) can be a little tricky to manually test. One suggestion is to make a copy of `config/.storage/core.config_entries` and manually change the values of `access_token`, `refresh_token`, and `expires_at` depending on the scenario you want to test. You can then walk advance through the reauth flow and confirm that the values get replaced with new valid tokens. Automated tests should verify that the reauth flow updates the existing config entry and does not create additional entries. + +## Testing your config flow + +Integrations with a config flow require full test coverage of all code in `config_flow.py` to be accepted into core. [Test your code](development_testing.md#testing-outside-of-tox) includes more details on how to generate a coverage report. diff --git a/docs/development_checklist.md b/docs/development_checklist.md index ddcb4301..6586eb3e 100644 --- a/docs/development_checklist.md +++ b/docs/development_checklist.md @@ -8,7 +8,7 @@ Before you commit any changes, check your work against these requirements: - All communication to external devices or services must be wrapped in an external Python library hosted on [pypi](https://pypi.python.org/pypi). - New dependencies are added to `requirements_all.txt` (if applicable), using `python3 -m script.gen_requirements_all` - New codeowners are added to `CODEOWNERS` (if applicable), using `python3 -m script.hassfest` -- The `.coveragerc` file is updated to exclude your platform if there are no tests available or your new code uses a third-party library for communication with the device, service, or sensor +- The `.coveragerc` file is updated to exclude your platform if there are no tests available or your new code uses a third-party library for communication with the device, service, or sensor. `config_flow.py` can't be excluded as it must be fully tested (100% coverage). - The code is formatted using Black, as per these [guidelines](https://developers.home-assistant.io/blog/2019/07/31/black.html). This can be done running the command `black --fast homeassistant tests`. - Documentation is developed for [home-assistant.io](https://home-assistant.io/) - Visit the [website documentation](/documenting.md) for more information about contributing to [home-assistant.io](https://github.com/home-assistant/home-assistant.io).