Skip to content

Commit 0f688a7

Browse files
committed
new model unit tests
1 parent 494ad2c commit 0f688a7

15 files changed

+1020
-0
lines changed

test/unit/models/test_callback.py

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# coding: utf-8
2+
3+
"""
4+
Bandwidth
5+
6+
Bandwidth's Communication APIs
7+
8+
The version of the OpenAPI document: 1.0.0
9+
10+
Generated by OpenAPI Generator (https://openapi-generator.tech)
11+
12+
Do not edit the class manually.
13+
""" # noqa: E501
14+
15+
16+
import unittest
17+
18+
from bandwidth.models.callback import Callback
19+
from bandwidth.models.inbound_callback import InboundCallback
20+
from bandwidth.models.inbound_callback_message import InboundCallbackMessage
21+
from bandwidth.models.status_callback import StatusCallback
22+
from bandwidth.models.status_callback_message import StatusCallbackMessage
23+
24+
class TestCallback(unittest.TestCase):
25+
"""Callback unit test stubs"""
26+
27+
def setUp(self):
28+
pass
29+
30+
def tearDown(self):
31+
pass
32+
33+
def make_instance(self, include_optional) -> Callback:
34+
"""Test Callback
35+
include_optional is a boolean, when False only required
36+
params are included, when True both required and
37+
optional params are included """
38+
39+
def testCallback(self):
40+
"""Test Callback"""
41+
inbound_callback = Callback(InboundCallback(
42+
time = '2024-12-02T20:15:57.278Z',
43+
type = 'message-received',
44+
to = '+15552223333',
45+
description = 'Incoming message received',
46+
message = InboundCallbackMessage(
47+
id = '1661365814859loidf7mcwd4qacn7',
48+
owner = '+15553332222',
49+
application_id = '93de2206-9669-4e07-948d-329f4b722ee2',
50+
time = '2024-12-02T20:15:57.666Z',
51+
segment_count = 1,
52+
direction = 'in',
53+
to = ['+15552223333'],
54+
var_from = '+15553332222',
55+
),
56+
carrier_name = 'AT&T'
57+
))
58+
status_callback = Callback(StatusCallback(
59+
time = '2024-12-02T20:15:57.278Z',
60+
event_time = '2024-12-02T20:15:58.278Z',
61+
type = 'message-delivered',
62+
to = '+15552223333',
63+
description = 'Message delivered to carrier.',
64+
message = StatusCallbackMessage(
65+
id = '1661365814859loidf7mcwd4qacn7',
66+
owner = '+15553332222',
67+
application_id = '93de2206-9669-4e07-948d-329f4b722ee2',
68+
time = '2024-12-02T20:15:57.666Z',
69+
segment_count = 1,
70+
direction = 'in',
71+
to = ["+15552223333"],
72+
var_from = '+15553332222',
73+
text = 'Hello world',
74+
tag = 'custom string',
75+
media = ["https://dev.bandwidth.com/images/bandwidth-logo.png","https://dev.bandwidth.com/images/github_logo.png"],
76+
priority = 'default',
77+
channel = 'RBM', ),
78+
error_code = 4405,
79+
carrier_name = 'AT&T'
80+
))
81+
82+
assert inbound_callback is not None
83+
assert isinstance(inbound_callback, Callback)
84+
assert isinstance(inbound_callback.actual_instance, InboundCallback)
85+
assert status_callback is not None
86+
assert isinstance(status_callback, Callback)
87+
assert isinstance(status_callback.actual_instance, StatusCallback)
88+
89+
90+
if __name__ == '__main__':
91+
unittest.main()
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# coding: utf-8
2+
3+
"""
4+
Bandwidth
5+
6+
Bandwidth's Communication APIs
7+
8+
The version of the OpenAPI document: 1.0.0
9+
10+
Generated by OpenAPI Generator (https://openapi-generator.tech)
11+
12+
Do not edit the class manually.
13+
""" # noqa: E501
14+
15+
16+
import unittest
17+
18+
from bandwidth.models.error_source import ErrorSource
19+
20+
class TestErrorSource(unittest.TestCase):
21+
"""ErrorSource unit test stubs"""
22+
23+
def setUp(self):
24+
pass
25+
26+
def tearDown(self):
27+
pass
28+
29+
def make_instance(self, include_optional) -> ErrorSource:
30+
"""Test ErrorSource
31+
include_optional is a boolean, when False only required
32+
params are included, when True both required and
33+
optional params are included """
34+
if include_optional:
35+
return ErrorSource(
36+
parameter = 'parameter',
37+
var_field = 'var_field',
38+
header = 'header',
39+
reference = 'reference'
40+
)
41+
else:
42+
return ErrorSource(
43+
)
44+
45+
def testErrorSource(self):
46+
"""Test ErrorSource"""
47+
instance = self.make_instance(True)
48+
assert instance is not None
49+
assert isinstance(instance, ErrorSource)
50+
assert instance.parameter == 'parameter'
51+
assert instance.var_field == 'var_field'
52+
assert instance.header == 'header'
53+
assert instance.reference == 'reference'
54+
55+
if __name__ == '__main__':
56+
unittest.main()
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# coding: utf-8
2+
3+
"""
4+
Bandwidth
5+
6+
Bandwidth's Communication APIs
7+
8+
The version of the OpenAPI document: 1.0.0
9+
10+
Generated by OpenAPI Generator (https://openapi-generator.tech)
11+
12+
Do not edit the class manually.
13+
""" # noqa: E501
14+
15+
16+
import unittest
17+
from datetime import datetime
18+
19+
from bandwidth.models.inbound_callback import InboundCallback
20+
from bandwidth.models.inbound_callback_message import InboundCallbackMessage
21+
22+
class TestInboundCallback(unittest.TestCase):
23+
"""InboundCallback unit test stubs"""
24+
25+
def setUp(self):
26+
pass
27+
28+
def tearDown(self):
29+
pass
30+
31+
def make_instance(self, include_optional) -> InboundCallback:
32+
"""Test InboundCallback
33+
include_optional is a boolean, when False only required
34+
params are included, when True both required and
35+
optional params are included """
36+
if include_optional:
37+
return InboundCallback(
38+
time = '2024-12-02T20:15:57.278Z',
39+
type = 'message-received',
40+
to = '+15552223333',
41+
description = 'Incoming message received',
42+
message = InboundCallbackMessage(
43+
id = '1661365814859loidf7mcwd4qacn7',
44+
owner = '+15553332222',
45+
application_id = '93de2206-9669-4e07-948d-329f4b722ee2',
46+
time = '2024-12-02T20:15:57.666Z',
47+
segment_count = 1,
48+
direction = 'in',
49+
to = ['+15552223333'],
50+
var_from = '+15553332222',
51+
),
52+
carrier_name = 'AT&T'
53+
)
54+
else:
55+
return InboundCallback(
56+
time = '2024-12-02T20:15:57.278Z',
57+
type = 'message-received',
58+
to = '+15552223333',
59+
description = 'Incoming message received',
60+
message = None,
61+
)
62+
63+
def testInboundCallback(self):
64+
"""Test InboundCallback"""
65+
instance = self.make_instance(True)
66+
assert instance is not None
67+
assert isinstance(instance, InboundCallback)
68+
assert isinstance(instance.time, datetime)
69+
assert instance.type == 'message-received'
70+
assert instance.to == '+15552223333'
71+
assert instance.description == 'Incoming message received'
72+
assert isinstance(instance.message, InboundCallbackMessage)
73+
assert instance.message.id == '1661365814859loidf7mcwd4qacn7'
74+
assert instance.message.owner == '+15553332222'
75+
assert instance.message.application_id == '93de2206-9669-4e07-948d-329f4b722ee2'
76+
assert isinstance(instance.message.time, datetime)
77+
assert instance.message.segment_count == 1
78+
assert instance.message.direction == 'in'
79+
assert instance.message.to == ['+15552223333']
80+
assert instance.message.var_from == '+15553332222'
81+
82+
if __name__ == '__main__':
83+
unittest.main()
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# coding: utf-8
2+
3+
"""
4+
Bandwidth
5+
6+
Bandwidth's Communication APIs
7+
8+
The version of the OpenAPI document: 1.0.0
9+
10+
Generated by OpenAPI Generator (https://openapi-generator.tech)
11+
12+
Do not edit the class manually.
13+
""" # noqa: E501
14+
15+
16+
import unittest
17+
from datetime import datetime
18+
19+
from bandwidth.models.inbound_callback_message import InboundCallbackMessage
20+
from bandwidth.models.multi_channel_message_content import MultiChannelMessageContent
21+
from bandwidth.models.rbm_location_response import RbmLocationResponse
22+
from bandwidth.models.rbm_suggestion_response import RbmSuggestionResponse
23+
from bandwidth.models.rbm_message_content_file import RbmMessageContentFile
24+
25+
class TestInboundCallbackMessage(unittest.TestCase):
26+
"""InboundCallbackMessage unit test stubs"""
27+
28+
def setUp(self):
29+
pass
30+
31+
def tearDown(self):
32+
pass
33+
34+
def make_instance(self, include_optional) -> InboundCallbackMessage:
35+
"""Test InboundCallbackMessage
36+
include_optional is a boolean, when False only required
37+
params are included, when True both required and
38+
optional params are included """
39+
if include_optional:
40+
return InboundCallbackMessage(
41+
id = '1661365814859loidf7mcwd4qacn7',
42+
owner = '+15553332222',
43+
application_id = '93de2206-9669-4e07-948d-329f4b722ee2',
44+
time = '2024-12-02T20:15:57.666Z',
45+
segment_count = 1,
46+
direction = 'in',
47+
to = ['+15552223333'],
48+
var_from = '+15553332222',
49+
text = 'Hello world',
50+
tag = 'custom string',
51+
media = ['https://dev.bandwidth.com/images/bandwidth-logo.png', 'https://dev.bandwidth.com/images/github_logo.png'],
52+
priority = 'default',
53+
channel = 'RBM',
54+
content = MultiChannelMessageContent(
55+
text = '',
56+
media = RbmMessageContentFile(
57+
file_url = 'https://dev.bandwidth.com/images/bandwidth-logo.png',
58+
thumbnail_url = 'https://dev.bandwidth.com/images/bandwidth-logo.png', ), ),
59+
suggestion_response = RbmSuggestionResponse(
60+
text = 'Yes, I would like to proceed',
61+
postback_data = '[B@5d4a34ff', ),
62+
location_response = RbmLocationResponse(
63+
latitude = '37.7749',
64+
longitude = '-122.4194', )
65+
)
66+
else:
67+
return InboundCallbackMessage(
68+
id = '1661365814859loidf7mcwd4qacn7',
69+
owner = '+15553332222',
70+
application_id = '93de2206-9669-4e07-948d-329f4b722ee2',
71+
time = '2024-12-02T20:15:57.666Z',
72+
segment_count = 1,
73+
direction = 'in',
74+
to = ['+15552223333'],
75+
var_from = '+15553332222',
76+
)
77+
78+
def testInboundCallbackMessage(self):
79+
"""Test InboundCallbackMessage"""
80+
instance = self.make_instance(True)
81+
assert instance is not None
82+
assert isinstance(instance, InboundCallbackMessage)
83+
assert instance.id == '1661365814859loidf7mcwd4qacn7'
84+
assert instance.owner == '+15553332222'
85+
assert instance.application_id == '93de2206-9669-4e07-948d-329f4b722ee2'
86+
assert isinstance(instance.time, datetime)
87+
assert instance.segment_count == 1
88+
assert instance.direction == 'in'
89+
assert instance.to == ['+15552223333']
90+
assert instance.var_from == '+15553332222'
91+
assert instance.text == 'Hello world'
92+
assert instance.tag == 'custom string'
93+
assert isinstance(instance.media, list)
94+
assert len(instance.media) > 0
95+
assert isinstance(instance.content, MultiChannelMessageContent)
96+
assert isinstance(instance.suggestion_response, RbmSuggestionResponse)
97+
assert isinstance(instance.location_response, RbmLocationResponse)
98+
99+
if __name__ == '__main__':
100+
unittest.main()
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# coding: utf-8
2+
3+
"""
4+
Bandwidth
5+
6+
Bandwidth's Communication APIs
7+
8+
The version of the OpenAPI document: 1.0.0
9+
10+
Generated by OpenAPI Generator (https://openapi-generator.tech)
11+
12+
Do not edit the class manually.
13+
""" # noqa: E501
14+
15+
16+
import unittest
17+
18+
from bandwidth.models.inbound_callback_type_enum import InboundCallbackTypeEnum
19+
20+
class TestInboundCallbackTypeEnum(unittest.TestCase):
21+
"""InboundCallbackTypeEnum unit test stubs"""
22+
23+
def setUp(self):
24+
pass
25+
26+
def tearDown(self):
27+
pass
28+
29+
def testInboundCallbackTypeEnum(self):
30+
"""Test InboundCallbackTypeEnum"""
31+
message_received = InboundCallbackTypeEnum('message-received')
32+
request_location_response = InboundCallbackTypeEnum('request-location-response')
33+
suggestion_response = InboundCallbackTypeEnum('suggestion-response')
34+
assert message_received == 'message-received'
35+
assert request_location_response == 'request-location-response'
36+
assert suggestion_response == 'suggestion-response'
37+
38+
if __name__ == '__main__':
39+
unittest.main()

0 commit comments

Comments
 (0)