Skip to content

Commit 651f702

Browse files
committed
test: cover PATCH /dids/:id unassigning emergency_calling_service
Add wire-level test for unassigning an EmergencyCallingService from a Did by sending emergency_calling_service: {data: null} in the PATCH request body. Includes a fixture with the expected 200 response showing emergency_calling_service data: null in relationships.
1 parent d35e3f4 commit 651f702

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
interactions:
2+
- request:
3+
body: '{"data":{"id":"44957076-778a-4802-b60c-d22db0cda284","type":"dids","attributes":{},"relationships":{"emergency_calling_service":{"data":null}}}}'
4+
headers:
5+
Accept:
6+
- application/vnd.api+json
7+
Api-Key:
8+
- test-api-key
9+
Content-Type:
10+
- application/vnd.api+json
11+
method: PATCH
12+
uri: https://sandbox-api.didww.com/v3/dids/44957076-778a-4802-b60c-d22db0cda284
13+
response:
14+
body:
15+
string: '{"data":{"id":"44957076-778a-4802-b60c-d22db0cda284","type":"dids","attributes":{"blocked":false,"capacity_limit":1,"description":"string","terminated":false,"awaiting_registration":false,"number":"437xxxxxxxxx","expires_at":"2026-06-25T08:21:41.795Z","channels_included_count":2,"created_at":"2026-06-25T08:21:41.795Z","billing_cycles_count":1,"dedicated_channels_count":0,"emergency_enabled":false},"relationships":{"did_group":{"links":{"self":"https://sandbox-api.didww.com/v3/dids/44957076-778a-4802-b60c-d22db0cda284/relationships/did_group","related":"https://sandbox-api.didww.com/v3/dids/44957076-778a-4802-b60c-d22db0cda284/did_group"}},"emergency_calling_service":{"links":{"self":"https://sandbox-api.didww.com/v3/dids/44957076-778a-4802-b60c-d22db0cda284/relationships/emergency_calling_service","related":"https://sandbox-api.didww.com/v3/dids/44957076-778a-4802-b60c-d22db0cda284/emergency_calling_service"},"data":null}}},"meta":{"api_version":"2026-04-16"}}'
16+
headers:
17+
Content-Type:
18+
- application/vnd.api+json
19+
status:
20+
code: 200
21+
message: OK
22+
version: 1

tests/resources/test_did.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,3 +178,12 @@ def test_update_did_invalid_trunk_group_error(self, client):
178178
assert exc_info.value.status_code == 422
179179
assert len(exc_info.value.errors) == 1
180180
assert "voice_in_trunk_group" in exc_info.value.errors[0]["detail"]
181+
182+
@my_vcr.use_cassette("dids/update_unassign_ecs.yaml")
183+
def test_update_did_unassign_emergency_calling_service(self, client):
184+
did = Did.build("44957076-778a-4802-b60c-d22db0cda284")
185+
did._null_relationship("emergency_calling_service")
186+
response = client.dids().update(did)
187+
updated = response.data
188+
assert updated.id == "44957076-778a-4802-b60c-d22db0cda284"
189+
assert updated.emergency_enabled is False

0 commit comments

Comments
 (0)