diff --git a/Makefile b/Makefile index 5e44329..69bcf33 100644 --- a/Makefile +++ b/Makefile @@ -211,6 +211,7 @@ test-http-client: /workdir/get_full_account.http \ /workdir/create_group.http \ /workdir/get_group.http \ + /workdir/delete_group.http \ /workdir/rename_device.http \ /workdir/unregister_device.http \ --report; \ diff --git a/tests/integration/http-client/COVERAGE.md b/tests/integration/http-client/COVERAGE.md index 96c534b..a2f82ab 100644 --- a/tests/integration/http-client/COVERAGE.md +++ b/tests/integration/http-client/COVERAGE.md @@ -42,8 +42,8 @@ Legend: ✅ covered · ⬜ gap · 〰️ partial (some status/variant uncovered) | GET | `/streaming/account/{a}/device/{d}/recents` | 200 | `get_recents.http` | ✅ | | POST | `/streaming/account/{a}/source` | 200 | `set_preset_5.http` | ✅ | | POST | `/streaming/account/{a}/group/` | 201 | `create_group.http` | ✅ | -| DELETE | `/streaming/account/{a}/group/` | 405 | (method-not-allowed edge) | ⬜ | -| DELETE | `/streaming/account/{a}/group/{id}` | 200 | — | ⬜ | +| DELETE | `/streaming/account/{a}/group/` | 200 | `delete_group.http` | ✅ (account-level teardown) | +| DELETE | `/streaming/account/{a}/group/{id}` | 200 | `delete_group.http` | ✅ | | GET | `/streaming/device/{d}/streaming_token` | 200 | `get_streaming_token.http` | ✅ | | GET | `/streaming/software/update/account/{a}` | 200 | `get_software_update.http` | ✅ | | GET | `/streaming/sourceproviders` | 200 | `get_sourceproviders.http` | ✅ | diff --git a/tests/integration/http-client/create_group.http b/tests/integration/http-client/create_group.http index c69972e..2ef491e 100644 --- a/tests/integration/http-client/create_group.http +++ b/tests/integration/http-client/create_group.http @@ -63,4 +63,11 @@ Accept: application/vnd.bose.streaming-v1.2+xml const roles = group.getElementsByTagName("groupRole"); client.assert(roles.length === 2, "Response should contain exactly 2 entries, got " + roles.length); }); + + // Capture the new group id (last path segment of the Location header) so the + // delete-group lifecycle step (delete_group.http) can remove this group. + (function () { + const loc = response.headers.valueOf("Location"); + client.global.set("groupId", loc ? loc.substring(loc.lastIndexOf("/") + 1) : ""); + })(); %} \ No newline at end of file diff --git a/tests/integration/http-client/delete_group.http b/tests/integration/http-client/delete_group.http new file mode 100644 index 0000000..9361784 --- /dev/null +++ b/tests/integration/http-client/delete_group.http @@ -0,0 +1,40 @@ +### DELETE /streaming/account/{accountId}/group/{groupId} (remove a specific group) +### +### Completes the group lifecycle: create_group.http created the group and +### captured its id into {{groupId}}; this removes that group +### (HandleMargeDeleteGroup -> 200 with a body). Runs after get_group.http +### and before the device teardown so the group exists when we delete it. +DELETE {{host}}/streaming/account/{{accountId}}/group/{{groupId}} +Content-Type: application/vnd.bose.streaming-v1.2+xml +Authorization: Bearer {{token}} +User-Agent: Bose_Lisa/27.0.6 +Accept: application/vnd.bose.streaming-v1.2+xml + +> {% + client.test("Group deleted (200)", function () { + client.assert(response.status === 200, "Response status is not 200, got " + response.status); + client.assert(response.contentType.mimeType === "application/vnd.bose.streaming-v1.2+xml", + "Expected application/vnd.bose.streaming-v1.2+xml, got '" + response.contentType.mimeType + "'"); + }); + + client.test("Response body confirms deletion", function () { + client.assert(response.body.getElementsByTagName("status").length > 0, + "Response should contain a element"); + }); +%} + +### DELETE /streaming/account/{accountId}/group/ (account-level teardown, no id) +### +### The no-id, trailing-slash form a speaker sends to clear all of an account's +### groups (e.g. during a factory reset). HandleMargeDeleteAccountGroups -> 200. +DELETE {{host}}/streaming/account/{{accountId}}/group/ +Content-Type: application/vnd.bose.streaming-v1.2+xml +Authorization: Bearer {{token}} +User-Agent: Bose_Lisa/27.0.6 +Accept: application/vnd.bose.streaming-v1.2+xml + +> {% + client.test("Account-level group teardown (200)", function () { + client.assert(response.status === 200, "Response status is not 200, got " + response.status); + }); +%}