10000 Add recording delete instance test · PNPtutorials/twilio-python@5619977 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5619977

Browse files
author
Kevin Burke
committed
Add recording delete instance test
1 parent ac46b54 commit 5619977

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ analysis:
1616
test: analysis
1717
. venv/bin/activate; nosetests
1818

19+
cover:
20+
. venv/bin/activate; nosetests --with-coverage --cover-package=twilio
21+
1922
docs-install:
2023
. venv/bin/activate; pip install -r docs/requirements.txt
2124

tests/test_recordings.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
from datetime import date
22
from mock import patch
33
from nose.tools import raises, assert_equals, assert_true
4-
from twilio.rest.resources import Recordings
4+
55
from tools import create_mock_json
6+
from twilio.rest.resources import Recordings, Recording
67

78
BASE_URI = "https://api.twilio.com/2010-04-01/Accounts/AC123"
89
ACCOUNT_SID = "AC123"
@@ -40,7 +41,7 @@ def test_get(mock):
4041

4142

4243
@patch("twilio.rest.resources.base.make_twilio_request")
43-
def test_get2(mock):
44+
def test_delete_list(mock):
4445
resp = create_mock_json("tests/resources/recordings_instance.json")
4546
resp.status_code = 204
4647
mock.return_value = resp
@@ -52,6 +53,20 @@ def test_get2(mock):
5253
assert_true(r)
5354

5455

56+
@patch("twilio.rest.resources.base.make_twilio_request")
57+
def test_delete_instance(mock):
58+
resp = create_mock_json("tests/resources/recordings_instance.json")
59+
resp.status_code = 204
60+
mock.return_value = resp
61+
62+
uri = "%s/Recordings/%s" % (BASE_URI, RE_SID)
63+
rec = Recording(recordings, RE_SID)
64+
r = rec.delete()
65+
66+
mock.assert_called_with("DELETE", uri, auth=AUTH)
67+
assert_true(r)
68+
69+
5570
@raises(AttributeError)
5671
def test_create():
5772
recordings.create

0 commit comments

Comments
 (0)
0