8000 Added Streams and DataSessions · DropByDrop/twilio-python@b29200a · GitHub
[go: up one dir, main page]

Skip to content

Commit b29200a

Browse files
committed
Added Streams and DataSessions
1 parent a84d6e2 commit b29200a

File tree

7 files changed

+1349
-0
lines changed

7 files changed

+1349
-0
lines changed
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: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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 import serialize
12+
from twilio.base.exceptions import TwilioException
13+
from twilio.http.response import Response
14+
15+
16+
class StreamMessageTestCase(IntegrationTestCase):
17+
18+
def test_create_request(self):
19+
self.holodeck.mock(Response(500, ''))
20+
21+
with self.assertRaises(TwilioException):
22+
self.client.sync.v1.services(sid="ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
23+
.sync_streams(sid="TOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
24+
.stream_messages.create(data="{}")
25+
26+
values = {
27+
'Data': serialize.object("{}"),
28+
}
29+
30+
self.holodeck.assert_has_request(Request(
31+
'post',
32+
'https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Streams/TOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages',
33+
data=values,
34+
))
35+
36+
def test_create_response(self):
37+
self.holodeck.mock(Response(
38+
201,
39+
'''
40+
{
41+
"sid": "TZaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
42+
"data": {}
43+
}
44+
'''
45+
))
46+
47+
actual = self.client.sync.v1.services(sid="ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
48+
.sync_streams(sid="TOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
49+
.stream_messages.create(data="{}")
50+
51+
self.assertIsNotNone(actual)
Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
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 SyncStreamTestCase(IntegrationTestCase):
16+
17+
def test_fetch_request(self):
18+
self.holodeck.mock(Response(500, ''))
19+
20+
with self.assertRaises(TwilioException):
21+
self.client.sync.v1.services(sid="ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
22+
.sync_streams(sid="TOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
23+
24+
self.holodeck.assert_has_request(Request(
25+
'get',
26+
'https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Streams/TOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
27+
))
28+
29+
def test_fetch_response(self):
30+
self.holodeck.mock(Response(
31+
200,
32+
'''
33+
{
34+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
35+
"created_by": "created_by",
36+
"date_created": "2015-07-30T20:00:00Z",
37+
"date_updated": "2015-07-30T20:00:00Z",
38+
"links": {
39+
"messages": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Streams/TOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages"
40+
},
41+
"service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
42+
"sid": "TOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
43+
"unique_name": "unique_name",
44+
"url": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Streams/TOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
45+
}
46+
'''
47+
))
48+
49+
actual = self.client.sync.v1.services(sid="ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
50+
.sync_streams(sid="TOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
51+
52+
self.assertIsNotNone(actual)
53+
54+
def test_delete_request(self):
55+
self.holodeck.mock(Response(500, ''))
56+
57+
with self.assertRaises(TwilioException):
58+
self.client.sync.v1.services(sid="ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
59+
.sync_streams(sid="TOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
60+
61+
self.holodeck.assert_has_request(Request(
62+
'delete',
63+
'https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Streams/TOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
64+
))
65+
66+
def test_delete_response(self):
67+
self.holodeck.mock(Response(
68+
204,
69+
None,
70+
))
71+
72+
actual = self.client.sync.v1.services(sid="ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
73+
.sync_streams(sid="TOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").delete()
74+
75+
self.assertTrue(actual)
76+
77+
def test_create_request(self):
78+
self.holodeck.mock(Response(500, ''))
79+
80+
with self.assertRaises(TwilioException):
81+
self.client.sync.v1.services(sid="ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
82+
.sync_streams.create()
83+
84+
self.holodeck.assert_has_request(Request(
85+
'post',
86+
'https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Streams',
87+
))
88+
89+
def test_create_response(self):
90+
self.holodeck.mock(Response(
91+
201,
92+
'''
93+
{
94+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
95+
"created_by": "created_by",
96+
"date_created": "2015-07-30T20:00:00Z",
97+
"date_updated": "2015-07-30T20:00:00Z",
98+
"links": {
99+
"messages": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Streams/TOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages"
100+
},
101+
"service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
102+
"sid": "TOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
103+
"unique_name": "unique_name",
104+
"url": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Streams/TOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
105+
}
106+
'''
107+
))
108+
109+
actual = self.client.sync.v1.services(sid="ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
110+
.sync_streams.create()
111+
112+
self.assertIsNotNone(actual)
113+
114+
def test_list_request(self):
115+
self.holodeck.mock(Response(500, ''))
116+
117+
with self.assertRaises(TwilioException):
118+
self.client.sync.v1.services(sid="ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
119+
.sync_streams.list()
120+
121+
self.holodeck.assert_has_request(Request(
122+
'get',
123+
'https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Streams',
124+
))
125+
126+
def test_read_empty_response(self):
127+
self.holodeck.mock(Response(
128+
200,
129+
'''
130+
{
131+
"streams": [],
132+
"meta": {
133+
"first_page_url": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Streams?PageSize=50&Page=0",
134+
"key": "streams",
135+
"next_page_url": null,
136+
"page": 0,
137+
"page_size": 50,
138+
"previous_page_url": null,
139+
"url": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Streams?PageSize=50&Page=0"
140+
}
141+
}
142+
'''
143+
))
144+
145+
actual = self.client.sync.v1.services(sid="ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
146+
.sync_streams.list()
147+
148+
self.assertIsNotNone(actual)
149+
150+
def test_read_full_response(self):
151+
self.holodeck.mock(Response(
152+
200,
153+
'''
154+
{
155+
"streams": [
156+
{
157+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
158+
"created_by": "created_by",
159+
"date_created": "2015-07-30T20:00:00Z",
160+
"date_updated": "2015-07-30T20:00:00Z",
161+
"links": {
162+
"messages": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Streams/TOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages"
163+
},
164+
"service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
165+
"sid": "TOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
166+
"unique_name": "unique_name",
167+
"url": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Streams/TOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
168+
}
169+
],
170+
"meta": {
171+
"first_page_url": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Streams?PageSize=50&Page=0",
172+
"key": "streams",
173+
"next_page_url": null,
174+
"page": 0,
175+
"page_size": 50,
176+
"previous_page_url": null,
177+
"url": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Streams?PageSize=50&Page=0"
178+
}
179+
}
180+
'''
181+
))
182+
183+
actual = self.client.sync.v1.services(sid="ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
184+
.sync_streams.list()
185+
186+
self.assertIsNotNone(actual)
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
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 DataSessionTestCase(IntegrationTestCase):
16+
17+
def test_list_request(self):
18+
self.holodeck.mock(Response(500, ''))
19+
20+
with self.assertRaises(TwilioException):
21+
self.client.wireless.v1.sims(sid="DEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
22+
.data_sessions.list()
23+
24+
self.holodeck.assert_has_request(Request(
25+
'get',
26+
'https://wireless.twilio.com/v1/Sims/DEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/DataSessions',
27+
))
28+
29+
def test_fetch_response(self):
30+
self.holodeck.mock(Response(
31+
200,
32+
'''
33+
{
34+
"data_sessions": [
35+
{
36+
"sid": "WNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
37+
"sim_sid": "DEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
38+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
39+
"radio_link": "LTE",
40+
"operator_mcc": 0,
41+
"operator_mnc": 0,
42+
"operator_country": "",
43+
"operator_name": "",
44+
"cell_id": "",
45+
"cell_location_estimate": {},
46+
"packets_uploaded": 0,
47+
"packets_downloaded": 0,
48+
"last_updated": "2015-07-30T20:00:00Z",
49+
"start": "2015-07-30T20:00:00Z",
50+
"end": null
51+
},
52+
{
53+
"sid": "WNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
54+
"sim_sid": "DEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
55+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
56+
"radio_link": "3G",
57+
"operator_mcc": 0,
58+
"operator_mnc": 0,
59+
"operator_country": "",
60+
"operator_name": "",
61+
"cell_id": "",
62+
"cell_location_estimate": {},
63+
"packets_uploaded": 0,
64+
"packets_downloaded": 0,
65+
"last_updated": "2015-07-30T20:00:00Z",
66+
"start": "2015-07-30T20:00:00Z",
67+
"end": "2015-07-30T20:00:00Z"
68+
}
69+
],
70+
"meta": {
71+
"first_page_url": "https://wireless.twilio.com/v1/Sims/DEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/DataSessions?PageSize=50&Page=0",
72+
"key": "data_sessions",
73+
"next_page_url": null,
74+
"page": 0,
75+
"page_size": 50,
76+
"previous_page_url": null,
77+
"url": "https://wireless.twilio.com/v1/Sims/DEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/DataSessions?PageSize=50&Page=0"
78+
}
79+
}
80+
'''
81+
))
82+
83+
actual = self.client.wireless.v1.sims(sid="DEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
84+
.data_sessions.list()
85+
86+
self.assertIsNotNone(actual)

0 commit comments

Comments
 (0)
0