Fix cross-platform grouping tests for get_groupable_players#3
Conversation
Co-authored-by: dan-s-github <20974454+dan-s-github@users.noreply.github.com>
|
@copilot we also need a test for multi-platform support as this is the main driver behind this service implementation |
I'm confused by this request. The current implementation (line 1224 in init.py) filters entities by platform: The test I removed was patching this method to bypass the platform filtering, which doesn't test the actual implementation. Could you clarify:
|
|
@copilot the default implementation will only return entities from the same platform, but other media_player entities can override this method and return entities from multiple platforms that could be grouped |
Co-authored-by: dan-s-github <20974454+dan-s-github@users.noreply.github.com>
Added test in commit 4b8f5b8 that demonstrates how integrations can override |
fe97877
into
feature/get-groupable-players-2342
The
test_get_groupable_players_multiplatformtest patchedMediaPlayerEntity.async_get_groupable_playersto return cross-platform results, creating a false impression that the service supports cross-platform grouping by default.Changes
test_get_groupable_players_multiplatformfromtests/components/media_player/test_init.py- this test patched the implementation and bypassed actual behaviortest_get_groupable_players_multiplatform_overrideto demonstrate how integrations can override the method for multi-platform grouping supportContext
The default implementation filters by platform:
The removed test bypassed this filtering by patching the method, misrepresenting the service's behavior. The new test properly demonstrates how integrations can override
async_get_groupable_playersto return entities from multiple platforms when they have integration-specific logic to support cross-platform grouping.Test Coverage
Remaining tests now accurately cover:
test_get_groupable_players_service- Basic service functionalitytest_get_groupable_players_entity_without_feature- Feature requirement enforcementtest_get_groupable_players_same_platform_only- Default same-platform filtering behaviortest_get_groupable_players_multiplatform_override- Integration override capability for multi-platform grouping💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.