Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/didww/resources/did_reservation.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from didww.exceptions import DidwwApiError
from didww.resources.base import DidwwApiModel, SafeAttributeField, RelationField, Repository


Expand All @@ -17,3 +18,10 @@ class Meta:
class DidReservationRepository(Repository):
_resource_class = DidReservation
_path = "did_reservations"

def delete(self, resource_id):
try:
self.client.delete(f"{self._path}/{resource_id}")
except DidwwApiError as e:
if e.status_code != 404:
raise
22 changes: 22 additions & 0 deletions tests/fixtures/addresses/delete.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
interactions:
- request:
body: null
headers:
Accept:
- application/vnd.api+json
Api-Key:
- test-api-key
Content-Type:
- application/vnd.api+json
method: DELETE
uri: https://sandbox-api.didww.com/v3/addresses/bf69bc70-e1c2-442c-9f30-335ee299b663
response:
body:
string: ''
headers:
Content-Type:
- application/vnd.api+json
status:
code: 204
message: No Content
version: 1
11 changes: 4 additions & 7 deletions tests/fixtures/did_reservations/delete.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,14 @@ interactions:
Content-Type:
- application/vnd.api+json
method: DELETE
uri: https://sandbox-api.didww.com/v3/did_reservations/unknown-id
uri: https://sandbox-api.didww.com/v3/did_reservations/fd38d3ff-80cf-4e67-a605-609a2884a5c4
response:
body:
string: "{\n \"errors\": [\n {\n \"title\": \"Record not found\",\n\
\ \"detail\": \"The record identified by fd38d3ff-80cf-4e67-a605-609a2884a5c4\
\ could not be found.\",\n \"code\": \"404\",\n \"status\": \"404\"\
\n }\n ]\n}"
string: ''
headers:
Content-Type:
- application/vnd.api+json
status:
code: 200
message: OK
code: 204
message: No Content
version: 1
25 changes: 25 additions & 0 deletions tests/fixtures/did_reservations/delete_not_found.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
interactions:
- request:
body: null
headers:
Accept:
- application/vnd.api+json
Api-Key:
- test-api-key
Content-Type:
- application/vnd.api+json
method: DELETE
uri: https://sandbox-api.didww.com/v3/did_reservations/fd38d3ff-80cf-4e67-a605-609a2884a5c4
response:
body:
string: "{\n \"errors\": [\n {\n \"title\": \"Record not found\",\n\
\ \"detail\": \"The record identified by fd38d3ff-80cf-4e67-a605-609a2884a5c4\
\ could not be found.\",\n \"code\": \"404\",\n \"status\": \"404\"\
\n }\n ]\n}"
headers:
Content-Type:
- application/vnd.api+json
status:
code: 404
message: Not Found
version: 1
22 changes: 22 additions & 0 deletions tests/fixtures/encrypted_files/delete.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
interactions:
- request:
body: null
headers:
Accept:
- application/vnd.api+json
Api-Key:
- test-api-key
Content-Type:
- application/vnd.api+json
method: DELETE
uri: https://sandbox-api.didww.com/v3/encrypted_files/7f2fbdca-8008-44ce-bcb6-3537ea5efaac
response:
body:
string: ''
headers:
Content-Type:
- application/vnd.api+json
status:
code: 204
message: No Content
version: 1
22 changes: 22 additions & 0 deletions tests/fixtures/identities/delete.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
interactions:
- request:
body: null
headers:
Accept:
- application/vnd.api+json
Api-Key:
- test-api-key
Content-Type:
- application/vnd.api+json
method: DELETE
uri: https://sandbox-api.didww.com/v3/identities/e96ae7d1-11d5-42bc-a5c5-211f3c3788ae
response:
body:
string: ''
headers:
Content-Type:
- application/vnd.api+json
status:
code: 204
message: No Content
version: 1
22 changes: 22 additions & 0 deletions tests/fixtures/permanent_supporting_documents/delete.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
interactions:
- request:
body: null
headers:
Accept:
- application/vnd.api+json
Api-Key:
- test-api-key
Content-Type:
- application/vnd.api+json
method: DELETE
uri: https://sandbox-api.didww.com/v3/permanent_supporting_documents/19510da3-c07e-4fa9-a696-6b9ab89cc172
response:
body:
string: ''
headers:
Content-Type:
- application/vnd.api+json
status:
code: 204
message: No Content
version: 1
22 changes: 22 additions & 0 deletions tests/fixtures/proofs/delete.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
interactions:
- request:
body: null
headers:
Accept:
- application/vnd.api+json
Api-Key:
- test-api-key
Content-Type:
- application/vnd.api+json
method: DELETE
uri: https://sandbox-api.didww.com/v3/proofs/ed46925b-a830-482d-917d-015858cf7ab9
response:
body:
string: ''
headers:
Content-Type:
- application/vnd.api+json
status:
code: 204
message: No Content
version: 1
22 changes: 22 additions & 0 deletions tests/fixtures/shared_capacity_groups/delete.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
interactions:
- request:
body: null
headers:
Accept:
- application/vnd.api+json
Api-Key:
- test-api-key
Content-Type:
- application/vnd.api+json
method: DELETE
uri: https://sandbox-api.didww.com/v3/shared_capacity_groups/3688a9c3-354f-4e16-b458-1d2df9f02547
response:
body:
string: ''
headers:
Content-Type:
- application/vnd.api+json
status:
code: 204
message: No Content
version: 1
22 changes: 22 additions & 0 deletions tests/fixtures/voice_in_trunk_groups/delete.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
interactions:
- request:
body: null
headers:
Accept:
- application/vnd.api+json
Api-Key:
- test-api-key
Content-Type:
- application/vnd.api+json
method: DELETE
uri: https://sandbox-api.didww.com/v3/voice_in_trunk_groups/b2319703-ce6c-480d-bb53-614e7abcfc96
response:
body:
string: ''
headers:
Content-Type:
- application/vnd.api+json
status:
code: 204
message: No Content
version: 1
22 changes: 22 additions & 0 deletions tests/fixtures/voice_in_trunks/delete.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
interactions:
- request:
body: null
headers:
Accept:
- application/vnd.api+json
Api-Key:
- test-api-key
Content-Type:
- application/vnd.api+json
method: DELETE
uri: https://sandbox-api.didww.com/v3/voice_in_trunks/41b94706-325e-4704-a433-d65105758836
response:
body:
string: ''
headers:
Content-Type:
- application/vnd.api+json
status:
code: 204
message: No Content
version: 1
22 changes: 22 additions & 0 deletions tests/fixtures/voice_out_trunks/delete.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
interactions:
- request:
body: null
headers:
Accept:
- application/vnd.api+json
Api-Key:
- test-api-key
Content-Type:
- application/vnd.api+json
method: DELETE
uri: https://sandbox-api.didww.com/v3/voice_out_trunks/425ce763-a3a9-49b4-af5b-ada1a65c8864
response:
body:
string: ''
headers:
Content-Type:
- application/vnd.api+json
status:
code: 204
message: No Content
version: 1
5 changes: 5 additions & 0 deletions tests/resources/test_address.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,8 @@ def test_create_address(self, client):
assert created.country is not None
assert created.country.name == "United States"
assert created.country.iso == "US"

@my_vcr.use_cassette("addresses/delete.yaml")
def test_delete_address(self, client):
result = client.addresses().delete("bf69bc70-e1c2-442c-9f30-335ee299b663")
assert result is None
10 changes: 10 additions & 0 deletions tests/resources/test_did_reservation.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,13 @@ def test_create_did_reservation(self, client):
created = response.data
assert created.id == "fd38d3ff-80cf-4e67-a605-609a2884a5c4"
assert created.description == "DIDWW"

@my_vcr.use_cassette("did_reservations/delete.yaml")
def test_delete_did_reservation(self, client):
result = client.did_reservations().delete("fd38d3ff-80cf-4e67-a605-609a2884a5c4")
assert result is None

@my_vcr.use_cassette("did_reservations/delete_not_found.yaml")
def test_delete_did_reservation_not_found(self, client):
result = client.did_reservations().delete("fd38d3ff-80cf-4e67-a605-609a2884a5c4")
assert result is None
5 changes: 5 additions & 0 deletions tests/resources/test_encrypted_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,8 @@ def test_upload_encrypted_files_unexpected_response(self, client):
fingerprint="fingerprint-123",
files=[{"data": b"example"}],
)

@my_vcr.use_cassette("encrypted_files/delete.yaml")
def test_delete_encrypted_file(self, client):
result = client.encrypted_files().delete("7f2fbdca-8008-44ce-bcb6-3537ea5efaac")
assert result is None
5 changes: 5 additions & 0 deletions tests/resources/test_identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,8 @@ def test_create_identity(self, client):
assert created.country is not None
assert created.country.name == "United States"
assert created.country.iso == "US"

@my_vcr.use_cassette("identities/delete.yaml")
def test_delete_identity(self, client):
result = client.identities().delete("e96ae7d1-11d5-42bc-a5c5-211f3c3788ae")
assert result is None
5 changes: 5 additions & 0 deletions tests/resources/test_permanent_supporting_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@ def test_create_permanent_supporting_document(self, client):
tmpl = created.template
assert tmpl is not None
assert tmpl.name == "Germany Special Registration Form"

@my_vcr.use_cassette("permanent_supporting_documents/delete.yaml")
def test_delete_permanent_supporting_document(self, client):
result = client.permanent_supporting_documents().delete("19510da3-c07e-4fa9-a696-6b9ab89cc172")
assert result is None
5 changes: 5 additions & 0 deletions tests/resources/test_proof.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@ def test_create_proof(self, client):
pt = created.proof_type
assert pt is not None
assert pt.name == "Drivers License"

@my_vcr.use_cassette("proofs/delete.yaml")
def test_delete_proof(self, client):
result = client.proofs().delete("ed46925b-a830-482d-917d-015858cf7ab9")
assert result is None
5 changes: 5 additions & 0 deletions tests/resources/test_shared_capacity_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@ def test_find_shared_capacity_group(self, client):
assert cp is not None
assert cp.name == "Standard"
assert len(scg.dids) >= 16

@my_vcr.use_cassette("shared_capacity_groups/delete.yaml")
def test_delete_shared_capacity_group(self, client):
result = client.shared_capacity_groups().delete("3688a9c3-354f-4e16-b458-1d2df9f02547")
assert result is None
5 changes: 5 additions & 0 deletions tests/resources/test_voice_in_trunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,8 @@ def test_configuration_deserialization(self):
config = TrunkConfiguration.from_jsonapi(data)
assert isinstance(config, SipConfiguration)
assert config.username == "user"

@my_vcr.use_cassette("voice_in_trunks/delete.yaml")
def test_delete_voice_in_trunk(self, client):
result = client.voice_in_trunks().delete("41b94706-325e-4704-a433-d65105758836")
assert result is None
5 changes: 5 additions & 0 deletions tests/resources/test_voice_in_trunk_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,8 @@ def test_create_voice_in_trunk_group(self, client):
assert created.name == "trunk group sample with 2 trunks"
assert created.capacity_limit == 1000
assert len(created.voice_in_trunks) == 2

@my_vcr.use_cassette("voice_in_trunk_groups/delete.yaml")
def test_delete_voice_in_trunk_group(self, client):
result = client.voice_in_trunk_groups().delete("b2319703-ce6c-480d-bb53-614e7abcfc96")
assert result is None
5 changes: 5 additions & 0 deletions tests/resources/test_voice_out_trunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,8 @@ def test_create_voice_out_trunk(self, client):
assert created.id == "b60201c1-21f0-4d9a-aafa-0e6d1e12f22e"
assert created.name == "python-test"
assert created.status == VoiceOutTrunkStatus.ACTIVE

@my_vcr.use_cassette("voice_out_trunks/delete.yaml")
def test_delete_voice_out_trunk(self, client):
result = client.voice_out_trunks().delete("425ce763-a3a9-49b4-af5b-ada1a65c8864")
assert result is None