Skip to content

Fix BleBox action tests to assert library calls instead of faking state - #175460

Merged
joostlek merged 1 commit into
home-assistant:devfrom
bkobus-bbx:blebox/fix-action-test-mocks
Jul 3, 2026
Merged

Fix BleBox action tests to assert library calls instead of faking state#175460
joostlek merged 1 commit into
home-assistant:devfrom
bkobus-bbx:blebox/fix-action-test-mocks

Conversation

@bkobus-bbx

Copy link
Copy Markdown
Contributor

Proposed change

Action tests for BleBox entities (switch/cover/climate/light/sensor) faked state changes via side_effect instead of verifying the library was called correctly. This PR replaces those with assert_called_once_with() on the library mock.

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

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 diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

@home-assistant

home-assistant Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Hey there @bbx-a, @swistakm, mind taking a look at this pull request as it has been labeled with an integration (blebox) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of blebox can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant mark-draft Mark the pull request as draft.
  • @home-assistant ready-for-review Remove the draft status from the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign blebox Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant update-branch Update the pull request branch with the base branch.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) on the pull request.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This pull request updates BleBox integration action tests to stop faking device state changes via mock side effects and instead verify that the BleBox library methods are invoked with the expected arguments.

Changes:

  • Replace state-based assertions in BleBox action tests with mock call assertions (e.g., assert_called_once_with()).
  • Simplify sensor “None value” tests by setting native_value directly rather than via async_update side effects.
  • Refactor several climate/cover/light action tests to focus on verifying library calls from Home Assistant services.

Reviewed changes

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

Show a summary per file
File Description
tests/components/blebox/test_switch.py Switch action tests now assert BleBox switch library calls instead of mutating is_on via side effects.
tests/components/blebox/test_sensor.py Sensor “None value” behavior is tested by setting native_value directly.
tests/components/blebox/test_light.py Light action tests now assert library calls; effect handling adds a negative assertion for API commands.
tests/components/blebox/test_cover.py Cover action tests now assert library calls for open/close/stop/position/tilt operations.
tests/components/blebox/test_climate.py Climate action tests now assert BleBox library calls for HVAC mode and temperature setting.

Comment thread tests/components/blebox/test_light.py
Comment thread tests/components/blebox/test_light.py
@bkobus-bbx
bkobus-bbx marked this pull request as ready for review July 3, 2026 12:49
@joostlek
joostlek merged commit 96920cc into home-assistant:dev Jul 3, 2026
33 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 4, 2026
@bkobus-bbx
bkobus-bbx deleted the blebox/fix-action-test-mocks branch July 6, 2026 06:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants