Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@sweenu
Copy link

@sweenu sweenu commented Nov 3, 2025

Proposed change

This is the first step towards: #155651

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: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:
  • Link to developer documentation pull request:
  • Link to frontend pull request:

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:

@abmantis abmantis changed the title bbox: add tests Add tests for bbox Nov 3, 2025
Copy link
Member

@joostlek joostlek left a comment

Choose a reason for hiding this comment

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

I think mik's review already covers a lot of things that can be imporved

@home-assistant
Copy link

home-assistant bot commented Nov 4, 2025

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 November 4, 2025 06:08
@sweenu sweenu marked this pull request as ready for review November 4, 2025 08:18
@home-assistant home-assistant bot requested a review from joostlek November 4, 2025 08:18
@sweenu sweenu marked this pull request as draft November 4, 2025 08:18
@sweenu sweenu force-pushed the bbox_add_tests branch 3 times, most recently from 1b58642 to 5664b83 Compare November 4, 2025 13:24
@sweenu
Copy link
Author

sweenu commented Nov 4, 2025

Thanks a lot @mik-laj for your review!
I admit I didn't give as much effort as I should have into this first PR as most of it gets replaced eventually. But that makes your guys' job harder, so I will definitely be more careful in the next ones.

@sweenu sweenu marked this pull request as ready for review November 4, 2025 13:29
@mik-laj
Copy link
Contributor

mik-laj commented Nov 4, 2025

@sweenu I'm glad we've managed to get the code to this point now. I look forward to your next contributions!

Comment on lines 57 to 135
async def test_get_device_name(
hass: HomeAssistant,
device_tracker_config: ConfigType,
mock_bbox_api: MagicMock,
) -> None:
"""Test getting device name by MAC address."""
scanner = get_scanner(hass, device_tracker_config)
assert scanner is not None

# Test existing device
name = scanner.get_device_name("aa:bb:cc:dd:ee:ff")
assert name == "test_device"

# Test another existing device
name = scanner.get_device_name("ff:ee:dd:cc:bb:aa")
assert name == "another_device"

# Test non-existing device
name = scanner.get_device_name("11:22:33:44:55:66")
assert name is None
Copy link
Member

Choose a reason for hiding this comment

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

I think we could test this via snapshots

Copy link
Author

Choose a reason for hiding this comment

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

If I'm not wrong, snapshot_platform requires a config_entry_id which is not compatible with a legacy integration.

I'm planning on using snapshots as soon as I add a config flow. Is that okay for you ?

@home-assistant home-assistant bot marked this pull request as draft November 4, 2025 16:51
@sweenu sweenu marked this pull request as ready for review November 5, 2025 22:14
@home-assistant home-assistant bot requested a review from joostlek November 5, 2025 22:14
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.

3 participants