-
-
Notifications
You must be signed in to change notification settings - Fork 35.8k
Add tests for bbox #155750
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Add tests for bbox #155750
Conversation
f0a28ef to
030dab9
Compare
There was a problem hiding this 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
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
1b58642 to
5664b83
Compare
|
Thanks a lot @mik-laj for your review! |
5664b83 to
8a043de
Compare
|
@sweenu I'm glad we've managed to get the code to this point now. I look forward to your next contributions! |
3c35fe7 to
8a043de
Compare
| 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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 ?
8a043de to
fcdb31e
Compare
Proposed change
This is the first step towards: #155651
Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: