Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_message_delete_invalid(self):
http_client = Mock()
http_client.request.return_value = '{"errors": [{"code": 20, "description": "message not found", "parameter": null}]}'
with self.assertRaises(ErrorException):
Client('', http_client).message_delete('non-existent-message-id')
http_client.request.assert_called_once_with('messages/non-existent-message-id', 'DELETE', None)
def test_voice_recording_download(self):
http_client = Mock()
http_client.request.return_value = '{"data":null,"errors":[{"message":"No recording found for ID `00000000-0000-0000-0000-000000000000`.","code":13}],"pagination":{"totalCount":0,"pageCount":0,"currentPage":0,"perPage":0}}'
with self.assertRaises(ErrorException):
voice_recording = Client('', http_client).voice_recording_download('12348765-4321-0987-6543-210987654321',
'87654321-0987-6543-2109-876543210987',
'12345678-9012-3456-7890-123456789012')
http_client.request.return_value = '{"data":[{"id":"12345678-9012-3456-7890-123456789012","format":"wav","legId":"87654321-0987-6543-2109-876543210987","status":"done","duration":32,"type":"transfer","createdAt":"2018-01-01T00:00:01Z","updatedAt":"2018-01-01T00:00:05Z","deletedAt":null}],"pagination":{"totalCount":0,"pageCount":0,"currentPage":0,"perPage":0}}'
with self.assertRaises(ErrorException):
voice_recording = Client('', http_client).voice_recording_download('12348765-4321-0987-6543-210987654321',
'87654321-0987-6543-2109-876543210987',
'12345678-9012-3456-7890-123456789012')
def test_delete_number_invalid(self):
http_client = Mock()
http_client.request.return_value = '{"errors": [{"code": 20, "description": "number not found", "parameter": null}]}'
with self.assertRaises(ErrorException):
Client('', http_client).delete_number('non-existent-number')
http_client.request.assert_called_once_with('phone-numbers/non-existent-number', 'DELETE', None)
def test_contact_delete_invalid(self):
http_client = Mock()
http_client.request.return_value = '{"errors": [{"code": 20,"description": "contact not found","parameter": null}]}'
with self.assertRaises(ErrorException):
Client('', http_client).contact_delete('non-existent-contact-id')
http_client.request.assert_called_once_with('contacts/non-existent-contact-id', 'DELETE', None)
def test_verify_delete_invalid(self):
http_client = Mock()
http_client.request.return_value = '{"errors": [{"code": 20,"description": "verification id not found","parameter": null}]}'
with self.assertRaises(ErrorException):
Client('', http_client).verify_delete('non-existent-verify-id')
http_client.request.assert_called_once_with('verify/non-existent-verify-id', 'DELETE', None)
def test_voice_recording_download(self):
http_client = Mock()
http_client.request.return_value = '{"data":null,"errors":[{"message":"No recording found for ID `00000000-0000-0000-0000-000000000000`.","code":13}],"pagination":{"totalCount":0,"pageCount":0,"currentPage":0,"perPage":0}}'
with self.assertRaises(ErrorException):
voice_recording = Client('', http_client).voice_recording_download('12348765-4321-0987-6543-210987654321',
'87654321-0987-6543-2109-876543210987',
'12345678-9012-3456-7890-123456789012')
http_client.request.return_value = '{"data":[{"id":"12345678-9012-3456-7890-123456789012","format":"wav","legId":"87654321-0987-6543-2109-876543210987","status":"done","duration":32,"type":"transfer","createdAt":"2018-01-01T00:00:01Z","updatedAt":"2018-01-01T00:00:05Z","deletedAt":null}],"pagination":{"totalCount":0,"pageCount":0,"currentPage":0,"perPage":0}}'
with self.assertRaises(ErrorException):
voice_recording = Client('', http_client).voice_recording_download('12348765-4321-0987-6543-210987654321',
'87654321-0987-6543-2109-876543210987',
'12345678-9012-3456-7890-123456789012')