test: add tests that run against a fake device - #241
Open
Solmath wants to merge 7 commits into
Open
Conversation
Solmath
marked this pull request as ready for review
August 15, 2026 14:31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds tests for
StreamMagicClient. They run against a fake device, so they never connect to a real streamer and never change settings on one.Sorry for the size, most of it is JSON test data.
How it works
tests/fake_device.pyis a small aiohttp server that answers the same websocket messages a real streamer does.tests/conftest.pystarts it on localhost and connects a normalStreamMagicClientto it. The client uses its real connection code, only the device is fake.Test data
The fake device answers with JSON captured from two real streamers, stored in
tests/fixtures/<model>/. I replaced serial numbers, UDNs and track names with placeholders.cxn100/- API 1.9851n/- API 1.8The 851N files are a real capture, not a cut-down copy of the CXN100 one. It runs the older API and has no audio endpoints, which is what the tests for older devices rely on (
test_older_api_device_connects,test_audio_features_rejected_when_unsupported).What is covered
90 tests, split into connection, zone control, playback and audio.
CI
.github/workflows/tests.ymlruns pytest on Python 3.11 to 3.14.Happy to change anything here, especially the test data if you would rather have less of it.