mirror of
https://github.com/gesellix/Bose-SoundTouch.git
synced 2026-08-24 14:47:23 +00:00
test(integration): update http-client assertions for cloud-side AUX exclusion
Two HTTP client tests asserted AUX (id=10001 / sourceproviderid=9) was
present in /streaming/account/{a}/full and /streaming/account/{a}/sources.
After 2b40481 drops AUX from those cloud responses (matching real Bose
behaviour; see pkg/service/marge/marge.go getAccountSources), both
tests fail. Updates them to:
- Expect 5 sources in /full (down from 6) — INTERNET_RADIO,
LOCAL_INTERNET_RADIO, TUNEIN, RADIO_BROWSER, Spotify.
- Expect ids 10002/10003/10004 (not 10001/...) in /sources.
- Add explicit negative assertions that sourceproviderid=9 / id=10001
is *not* present, so a regression that re-introduces AUX in cloud
responses fails loud.
Verified via `make test-http-client`: 49 requests, 0 failures.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
74007c7cb2
commit
30456d7ff8
@@ -18,14 +18,20 @@ Authorization: Bearer dummy-token
|
||||
client.assert(sources.nodeName === "sources", "Root element is not 'sources'");
|
||||
|
||||
const sourceList = sources.getElementsByTagName("source");
|
||||
client.assert(sourceList.length >= 4, "Expected at least 4 source elements, found " + sourceList.length);
|
||||
client.assert(sourceList.length >= 3, "Expected at least 3 source elements, found " + sourceList.length);
|
||||
|
||||
const expectedIds = ["10001", "10002", "10003", "10004"];
|
||||
// AUX (id=10001, sourceproviderid=9) is intentionally excluded from
|
||||
// cloud responses — real Bose never emitted AUX in /full or /sources;
|
||||
// the speaker enumerates AUX from its own hardware via isLocal=true
|
||||
// in :8090/sources. See pkg/service/marge/marge.go getAccountSources
|
||||
// and commit 2b40481 (#195/#269).
|
||||
const expectedIds = ["10002", "10003", "10004"];
|
||||
for (let i = 0; i < sourceList.length; i++) {
|
||||
const source = sourceList.item(i);
|
||||
const sourceId = source.getAttribute("id");
|
||||
client.assert(sourceId !== "10001", "Cloud /sources must not include AUX (id=10001)");
|
||||
if (i < expectedIds.length) {
|
||||
client.assert(sourceId === expectedIds[i], "Wrong source ID at index " + i);
|
||||
client.assert(sourceId === expectedIds[i], "Wrong source ID at index " + i + ": got " + sourceId + ", want " + expectedIds[i]);
|
||||
}
|
||||
client.assert(source.getAttribute("type") === "Audio", "Wrong source type for source " + sourceId);
|
||||
|
||||
|
||||
@@ -47,6 +47,18 @@ Authorization: Bearer {{token}}
|
||||
client.assert(sources !== null, "Missing 'sources' element");
|
||||
var sourceCount = sources.getElementsByTagName("source").length;
|
||||
client.assert(sourceCount > 0, "No 'source' elements found in account sources");
|
||||
client.assert(sourceCount === 6, "Expected 6 sources (AUX, INTERNET_RADIO, LOCAL_INTERNET_RADIO, TUNEIN, RADIO_BROWSER, Spotify) but got " + sourceCount);
|
||||
// AUX (sourceproviderid=9) is intentionally excluded from cloud-side
|
||||
// /full responses — real Bose never emitted it; the speaker enumerates
|
||||
// AUX from its own hardware via isLocal=true in :8090/sources. See
|
||||
// pkg/service/marge/marge.go getAccountSources for the reasoning and
|
||||
// commit 2b40481 for the fix that closed #195/#269.
|
||||
client.assert(sourceCount === 5, "Expected 5 cloud sources (INTERNET_RADIO, LOCAL_INTERNET_RADIO, TUNEIN, RADIO_BROWSER, Spotify; AUX is hardware-local) but got " + sourceCount);
|
||||
|
||||
// Explicit negative assertion: AUX must not appear in /full.
|
||||
var sourceList = sources.getElementsByTagName("source");
|
||||
for (var i = 0; i < sourceList.length; i++) {
|
||||
var pid = sourceList[i].getElementsByTagName("sourceproviderid")[0];
|
||||
client.assert(!pid || pid.textContent !== "9", "/full must not include AUX (sourceproviderid=9)");
|
||||
}
|
||||
});
|
||||
%}
|
||||
|
||||
Reference in New Issue
Block a user