Skip to content

Commit 2996eb0

Browse files
authored
Merge branch 'alpha' into twiml-speech-recognition-alpha
2 parents 5da65bc + bcb7692 commit 2996eb0

File tree

233 files changed

+21633
-103
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

233 files changed

+21633
-103
lines changed

CHANGES.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,29 @@ twilio-python Changelog
33

44
Here you can see the full list of changes between each twilio-python release.
55

6+
[2018-05-24] Version 6.3.0-alpha-1
7+
----------------------------------
8+
9+
- Add HostedNumbers preview support.
10+
- Add Proxy preview support.
11+
- Add BulkExports preview support.
12+
13+
[2017-05-22] Version 6.2.0-alpha-1
14+
----------------------------------
15+
16+
- Update usage record categories.
17+
- Add `get_page` method for reentrant paging.
18+
- Add video domain.
19+
- Add wireless domain.
20+
- Add fax domain.
21+
- Add sync domain.
22+
- Add `area_code_geomatch` to messaging `Service`.
23+
24+
[2017-05-12] Version 6.1.2-alpha-1
25+
----------------------------------
26+
27+
- Support *kwargs in Gather TwiML
28+
629
[2017-05-10] Version 6.1.1-alpha-1
730
----------------------------------
831

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# coding=utf-8
2+
"""
3+
This code was generated by
4+
\ / _ _ _| _ _
5+
| (_)\/(_)(_|\/| |(/_ v1.0.0
6+
/ /
7+
"""
8+
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# coding=utf-8
2+
"""
3+
This code was generated by
4+
\ / _ _ _| _ _
5+
| (_)\/(_)(_|\/| |(/_ v1.0.0
6+
/ /
7+
"""
8+
9+
from tests import IntegrationTestCase
10+
from tests.holodeck import Request
11+
from twilio.base.exceptions import TwilioException
12+
from twilio.http.response import Response
13+
14+
15+
class FaxMediaTestCase(IntegrationTestCase):
16+
17+
def test_fetch_request(self):
18+
self.holodeck.mock(Response(500, ''))
19+
20+
with self.assertRaises(TwilioException):
21+
self.client.fax.v1.faxes(sid="FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
22+
.media(sid="MEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
23+
24+
self.holodeck.assert_has_request(Request(
25+
'get',
26+
'https://fax.twilio.com/v1/Faxes/FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media/MEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
27+
))
28+
29+
def test_fetch_response(self):
30+
self.holodeck.mock(Response(
31+
200,
32+
'''
33+
{
34+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
35+
"content_type": "application/pdf",
36+
"date_created": "2015-07-30T20:00:00Z",
37+
"date_updated": "2015-07-30T20:00:00Z",
38+
"fax_sid": "FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
39+
"sid": "MEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
40+
"url": "https://fax.twilio.com/v1/Faxes/FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media/MEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
41+
}
42+
'''
43+
))
44+
45+
actual = self.client.fax.v1.faxes(sid="FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
46+
.media(sid="MEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
47+
48+
self.assertIsNotNone(actual)
49+
50+
def test_list_request(self):
51+
self.holodeck.mock(Response(500, ''))
52+
53+
with self.assertRaises(TwilioException):
54+
self.client.fax.v1.faxes(sid="FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
55+
.media.list()
56+
57+
self.holodeck.assert_has_request(Request(
58+
'get',
59+
'https://fax.twilio.com/v1/Faxes/FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media',
60+
))
61+
62+
def test_read_response(self):
63+
self.holodeck.mock(Response(
64+
200,
65+
'''
66+
{
67+
"media": [
68+
{
69+
"sid": "MEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
70+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
71+
"fax_sid": "FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
72+
"content_type": "application/pdf",
73+
"date_created": "2015-07-30T20:00:00Z",
74+
"date_updated": "2015-07-30T20:00:00Z",
75+
"url": "https://fax.twilio.com/v1/Faxes/FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media/MEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
76+
}
77+
],
78+
"meta": {
79+
"first_page_url": "https://fax.twilio.com/v1/Faxes/FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media?PageSize=50&Page=0",
80+
"key": "media",
81+
"next_page_url": null,
82+
"page": 0,
83+
"page_size": 50,
84+
"previous_page_url": null,
85+
"url": "https://fax.twilio.com/v1/Faxes/FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media?PageSize=50&Page=0"
86+
}
87+
}
88+
'''
89+
))
90+
91+
actual = self.client.fax.v1.faxes(sid="FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
92+
.media.list()
93+
94+
self.assertIsNotNone(actual)
95+
96+
def test_delete_request(self):
97+
self.holodeck.mock(Response(500, ''))
98+
99+
with self.assertRaises(TwilioException):
100+
self.client.fax.v1.faxes(sid="FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
101+
.media(sid="MEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
102+
103+
self.holodeck.assert_has_request(Request(
104+
'delete',
105+
'https://fax.twilio.com/v1/Faxes/FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media/MEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
106+
))
107+
108+
def test_delete_response(self):
109+
self.holodeck.mock(Response(
110+
204,
111+
None,
112+
))
113+
114+
actual = self.client.fax.v1.faxes(sid="FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
115+
.media(sid="MEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
116+
117+
self.assertTrue(actual)

tests/integration/fax/v1/test_fax.py

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def test_fetch_response(self):
3737
"direction": "outbound",
3838
"from": "+14155551234",
3939
"media_url": "https://www.example.com/fax.pdf",
40+
"media_sid": "MEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
4041
"num_pages": null,
4142
"price": null,
4243
"price_unit": null,
@@ -45,6 +46,9 @@ def test_fetch_response(self):
4546
"status": "queued",
4647
"to": "+14155554321",
4748
"duration": null,
49+
"links": {
50+
"media": "https://fax.twilio.com/v1/Faxes/FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media"
51+
},
4852
"url": "https://fax.twilio.com/v1/Faxes/FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
4953
}
5054
'''
@@ -102,6 +106,7 @@ def test_read_full_response(self):
102106
"direction": "outbound",
103107
"from": "+14155551234",
104108
"media_url": "https://www.example.com/fax.pdf",
109+
"media_sid": "MEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
105110
"num_pages": null,
106111
"price": null,
107112
"price_unit": null,
@@ -110,6 +115,9 @@ def test_read_full_response(self):
110115
"status": "queued",
111116
"to": "+14155554321",
112117
"duration": null,
118+
"links": {
119+
"media": "https://fax.twilio.com/v1/Faxes/FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media"
120+
},
113121
"url": "https://fax.twilio.com/v1/Faxes/FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
114122
}
115123
],
@@ -134,10 +142,9 @@ def test_create_request(self):
134142
self.holodeck.mock(Response(500, ''))
135143

136144
with self.assertRaises(TwilioException):
137-
self.client.fax.v1.faxes.create(from_="from_", to="to", media_url="https://example.com")
145+
self.client.fax.v1.faxes.create(to="to", media_url="https://example.com")
138146

139147
values = {
140-
'From': "from_",
141148
'To': "to",
142149
'MediaUrl': "https://example.com",
143150
}
@@ -160,6 +167,7 @@ def test_create_response(self):
160167
"direction": "outbound",
161168
"from": "+14155551234",
162169
"media_url": null,
170+
"media_sid": null,
163171
"num_pages": null,
164172
"price": null,
165173
"price_unit": null,
@@ -168,12 +176,15 @@ def test_create_response(self):
168176
"status": "queued",
169177
"to": "+14155554321",
170178
"duration": null,
179+
"links": {
180+
"media": "https://fax.twilio.com/v1/Faxes/FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media"
181+
},
171182
"url": "https://fax.twilio.com/v1/Faxes/FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
172183
}
173184
'''
174185
))
175186

176-
actual = self.client.fax.v1.faxes.create(from_="from_", to="to", media_url="https://example.com")
187+
actual = self.client.fax.v1.faxes.create(to="to", media_url="https://example.com")
177188

178189
self.assertIsNotNone(actual)
179190

@@ -200,6 +211,7 @@ def test_update_response(self):
200211
"direction": "outbound",
201212
"from": "+14155551234",
202213
"media_url": null,
214+
"media_sid": null,
203215
"num_pages": null,
204216
"price": null,
205217
"price_unit": null,
@@ -208,6 +220,9 @@ def test_update_response(self):
208220
"status": "canceled",
209221
"to": "+14155554321",
210222
"duration": null,
223+
"links": {
224+
"media": "https://fax.twilio.com/v1/Faxes/FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media"
225+
},
211226
"url": "https://fax.twilio.com/v1/Faxes/FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
212227
}
213228
'''
@@ -216,3 +231,24 @@ def test_update_response(self):
216231
actual = self.client.fax.v1.faxes(sid="FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update()
217232

218233
self.assertIsNotNone(actual)
234+
235+
def test_delete_request(self):
236+
self.holodeck.mock(Response(500, ''))
237+
238+
with self.assertRaises(TwilioException):
239+
self.client.fax.v1.faxes(sid="FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
240+
241+
self.holodeck.assert_has_request(Request(
242+
'delete',
243+
'https://fax.twilio.com/v1/Faxes/FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
244+
))
245+
246+
def test_delete_response(self):
247+
self.holodeck.mock(Response(
248+
204,
249+
None,
250+
))
251+
252+
actual = self.client.fax.v1.faxes(sid="FXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
253+
254+
self.assertTrue(actual)

tests/integration/messaging/v1/test_service.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ def test_create_response(self):
4848
"sticky_sender": true,
4949
"smart_encoding": false,
5050
"mms_converter": true,
51+
"fallback_to_long_code": true,
52+
"scan_message_content": "inherit",
53+
"area_code_geomatch": true,
54+
"validity_period": 600,
5155
"links": {
5256
"phone_numbers": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers",
5357
"short_codes": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ShortCodes",
@@ -86,6 +90,10 @@ def test_update_response(self):
8690
"sticky_sender": false,
8791
"mms_converter": true,
8892
"smart_encoding": false,
93+
"fallback_to_long_code": true,
94+
"scan_message_content": "inherit",
95+
"area_code_geomatch": true,
96+
"validity_period": 600,
8997
"inbound_request_url": "https://www.example.com",
9098
"inbound_method": "POST",
9199
"fallback_url": null,
@@ -140,6 +148,10 @@ def test_read_full_response(self):
140148
"sticky_sender": true,
141149
"mms_converter": true,
142150
"smart_encoding": false,
151+
"fallback_to_long_code": true,
152+
"area_code_geomatch": true,
153+
"validity_period": 600,
154+
"scan_message_content": "inherit",
143155
"inbound_request_url": "https://www.example.com/",
144156
"inbound_method": "POST",
145157
"fallback_url": null,
@@ -190,6 +202,10 @@ def test_fetch_response(self):
190202
"sticky_sender": true,
191203
"mms_converter": true,
192204
"smart_encoding": false,
205+
"fallback_to_long_code": true,
206+
"area_code_geomatch": true,
207+
"validity_period": 600,
208+
"scan_message_content": "inherit",
193209
"links": {
194210
"phone_numbers": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers",
195211
"short_codes": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ShortCodes",
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# coding=utf-8
2+
"""
3+
This code was generated by
4+
\ / _ _ _| _ _
5+
| (_)\/(_)(_|\/| |(/_ v1.0.0
6+
/ /
7+
"""
8+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# coding=utf-8
2+
"""
3+
This code was generated by
4+
\ / _ _ _| _ _
5+
| (_)\/(_)(_|\/| |(/_ v1.0.0
6+
/ /
7+
"""
8+
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# coding=utf-8
2+
"""
3+
This code was generated by
4+
\ / _ _ _| _ _
5+
| (_)\/(_)(_|\/| |(/_ v1.0.0
6+
/ /
7+
"""
8+
9+
from tests import IntegrationTestCase
10+
from tests.holodeck import Request
11+
from twilio.base.exceptions import TwilioException
12+
from twilio.http.response import Response
13+
14+
15+
class DayTestCase(IntegrationTestCase):
16+
17+
def test_list_request(self):
18+
self.holodeck.mock(Response(500, ''))
19+
20+
with self.assertRaises(TwilioException):
21+
self.client.preview.bulk_exports.exports(resource_type="resource_type") \
22+
.days.list()
23+
24+
self.holodeck.assert_has_request(Request(
25+
'get',
26+
'https://preview.twilio.com/BulkExports/Exports/resource_type/Days',
27+
))
28+
29+
def test_read_response(self):
30+
self.holodeck.mock(Response(
31+
200,
32+
'''
33+
{
34+
"days": [
35+
{
36+
"day": "2017-05-01",
37+
"size": 1234,
38+
"resource_type": "Calls"
39+
}
40+
],
41+
"meta": {
42+
"key": "days",
43+
"page_size": 50,
44+
"url": "https://preview.twilio.com/BulkExports/Exports/Calls/Days?PageSize=50&Page=0",
45+
"page": 0,
46+
"first_page_url": "https://preview.twilio.com/BulkExports/Exports/Calls/Days?PageSize=50&Page=0",
47+
"previous_page_url": null,
48+
"next_page_url": null
49+
}
50+
}
51+
'''
52+
))
53+
54+
actual = self.client.preview.bulk_exports.exports(resource_type="resource_type") \
55+
.days.list()
56+
57+
self.assertIsNotNone(actual)

0 commit comments

Comments
 (0)