Skip to content

Conversation

@MarkGodwin
Copy link
Contributor

Proposed change

Changes requested in #156697. This retains 100% coverage of the config flow, and improves the test quality.

I think this gets to bronze quality level. If this passes, I'll put in a PR to bump it.

Bronze

  • action-setup - Service actions are registered in async_setup
  • appropriate-polling - If it's a polling integration, set an appropriate polling interval
  • brands - Has branding assets available for the integration
  • common-modules - Place common patterns in common modules
  • config-flow-test-coverage - Full test coverage for the config flow
  • config-flow - Integration needs to be able to be set up via the UI
    • Uses data_description to give context to fields
    • Uses ConfigEntry.data and ConfigEntry.options correctly
  • dependency-transparency - Dependency transparency
  • docs-actions - The documentation describes the provided service actions that can be used
  • docs-high-level-description - The documentation includes a high-level description of the integration brand, product, or service
  • docs-installation-instructions - The documentation provides step-by-step installation instructions for the integration, including, if needed, prerequisites
  • docs-removal-instructions - The documentation provides removal instructions
  • entity-event-setup - Entity events are subscribed in the correct lifecycle methods
  • entity-unique-id - Entities have a unique ID
  • has-entity-name - Entities use has_entity_name = True
  • runtime-data - Use ConfigEntry.runtime_data to store runtime data
  • test-before-configure - Test a connection in the config flow
  • test-before-setup - Check during integration initialization if we are able to set it up correctly
  • unique-config-entry - Don't allow the same device or service to be able to be set up twice

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: N/A
  • This PR is related to issue: N/A
  • Link to documentation pull request: N/A
  • Link to developer documentation pull request: N/A
  • Link to frontend pull request: N/A

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the TP-Link Omada config flow tests in response to feedback from #156697, improving test quality while maintaining 100% test coverage. The refactoring removes patching of internal config flow functions and instead mocks external APIs, following Home Assistant testing best practices.

Key changes:

  • Introduces proper test fixtures that mock the Omada client API instead of internal validation functions
  • Consolidates multiple error handling tests into parametrized tests to reduce code duplication
  • Adds controller ID validation during reauthentication to prevent users from reauthenticating with a different controller
  • Updates quality scale status from "todo" to "done" for config-flow-test-coverage

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
tests/components/tplink_omada/test_config_flow.py Refactors config flow tests to mock external APIs, adds fixtures for test setup, consolidates error tests using parametrization, and improves test coverage verification
homeassistant/components/tplink_omada/config_flow.py Adds controller ID validation in reauth flow to prevent reauthenticating with a different controller
homeassistant/components/tplink_omada/strings.json Adds user-facing abort message for device mismatch during reauth
homeassistant/components/tplink_omada/quality_scale.yaml Updates config-flow-test-coverage rule from todo to done status

@home-assistant
Copy link

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant home-assistant bot marked this pull request as draft December 29, 2025 16:36
@MarkGodwin MarkGodwin marked this pull request as ready for review December 29, 2025 17:00
@home-assistant home-assistant bot requested a review from joostlek December 29, 2025 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants