Skip to content

Commit 33ee3e7

Browse files
committed
models unit tests
1 parent 3c49669 commit 33ee3e7

25 files changed

+1699
-1
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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.additional_denial_reason import AdditionalDenialReason
19+
20+
class TestAdditionalDenialReason(unittest.TestCase):
21+
"""AdditionalDenialReason 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) -> AdditionalDenialReason:
30+
"""Test AdditionalDenialReason
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 AdditionalDenialReason(
36+
status_code = 511,
37+
reason = "Invalid Information - Can't Validate URL - Website is not accessible / not available",
38+
resubmit_allowed = True
39+
)
40+
else:
41+
return AdditionalDenialReason(
42+
status_code = 511,
43+
reason = "Invalid Information - Can't Validate URL - Website is not accessible / not available",
44+
resubmit_allowed = True,
45+
)
46+
47+
def testAdditionalDenialReason(self):
48+
"""Test AdditionalDenialReason"""
49+
instance = self.make_instance(True)
50+
assert instance is not None
51+
assert isinstance(instance, AdditionalDenialReason)
52+
assert instance.status_code == 511
53+
assert instance.reason == "Invalid Information - Can't Validate URL - Website is not accessible / not available"
54+
assert instance.resubmit_allowed == True
55+
56+
if __name__ == '__main__':
57+
unittest.main()

test/unit/models/test_address.py

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
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.address import Address
19+
20+
class TestAddress(unittest.TestCase):
21+
"""Address 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) -> Address:
30+
"""Test Address
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 Address(
36+
name = 'Bandwidth Inc.',
37+
addr1 = '2230 Bandmate Way',
38+
addr2 = '',
39+
city = 'Raleigh',
40+
state = 'NC',
41+
zip = '27606',
42+
url = 'https://www.example.com/path/to/resource'
43+
)
44+
else:
45+
return Address(
46+
name = 'Bandwidth Inc.',
47+
addr1 = '2230 Bandmate Way',
48+
city = 'Raleigh',
49+
state = 'NC',
50+
zip = '27606',
51+
url = 'https://www.example.com/path/to/resource',
52+
)
53+
54+
def testAddress(self):
55+
"""Test Address"""
56+
instance = self.make_instance(True)
57+
assert instance is not None
58+
assert isinstance(instance, Address)
59+
assert instance.name == 'Bandwidth Inc.'
60+
assert instance.addr1 == '2230 Bandmate Way'
61+
assert instance.addr2 == ''
62+
assert instance.city == 'Raleigh'
63+
assert instance.state == 'NC'
64+
assert instance.zip == '27606'
65+
assert instance.url == 'https://www.example.com/path/to/resource'
66+
67+
if __name__ == '__main__':
68+
unittest.main()

test/unit/models/test_contact.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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.contact import Contact
19+
20+
class TestContact(unittest.TestCase):
21+
"""Contact 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) -> Contact:
30+
"""Test Contact
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 Contact(
36+
first_name = 'John',
37+
last_name = 'Doe',
38+
email = '[email protected]',
39+
phone_number = '+19192654500'
40+
)
41+
else:
42+
return Contact(
43+
first_name = 'John',
44+
last_name = 'Doe',
45+
email = '[email protected]',
46+
phone_number = '+19192654500',
47+
)
48+
49+
def testContact(self):
50+
"""Test Contact"""
51+
instance = self.make_instance(True)
52+
assert instance is not None
53+
assert isinstance(instance, Contact)
54+
assert instance.first_name == 'John'
55+
assert instance.last_name == 'Doe'
56+
assert instance.email == '[email protected]'
57+
assert instance.phone_number == '+19192654500'
58+
59+
if __name__ == '__main__':
60+
unittest.main()

test/unit/models/test_dtmf_callback.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def make_instance(self, include_optional) -> DtmfCallback:
5858

5959
def testDtmfCallback(self):
6060
"""Test DtmfCallback"""
61-
instance = self.make_instance(include_optional=True)
61+
instance = self.make_instance(True)
6262
self.assertTrue(instance is not None)
6363
self.assertTrue(isinstance(instance, DtmfCallback))
6464
assert instance.event_type == 'bridgeComplete'

test/unit/models/test_error.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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 import Error
19+
from bandwidth.models.telephone_number import TelephoneNumber
20+
21+
class TestError(unittest.TestCase):
22+
"""Error unit test stubs"""
23+
24+
def setUp(self):
25+
pass
26+
27+
def tearDown(self):
28+
pass
29+
30+
def make_instance(self, include_optional) -> Error:
31+
"""Test Error
32+
include_optional is a boolean, when False only required
33+
params are included, when True both required and
34+
optional params are included """
35+
if include_optional:
36+
return Error(
37+
code = 56,
38+
description = '',
39+
telephone_numbers = [
40+
TelephoneNumber(
41+
telephone_number = '', )
42+
]
43+
)
44+
else:
45+
return Error(
46+
)
47+
48+
def testError(self):
49+
"""Test Error"""
50+
instance = self.make_instance(True)
51+
assert instance is not None
52+
assert isinstance(instance, Error)
53+
assert instance.code == 56
54+
assert instance.description == ''
55+
assert isinstance(instance.telephone_numbers, list)
56+
assert len(instance.telephone_numbers) == 1
57+
assert isinstance(instance.telephone_numbers[0], TelephoneNumber)
58+
assert instance.telephone_numbers[0].telephone_number == ''
59+
60+
if __name__ == '__main__':
61+
unittest.main()
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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.failure_webhook import FailureWebhook
19+
20+
class TestFailureWebhook(unittest.TestCase):
21+
"""FailureWebhook 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) -> FailureWebhook:
30+
"""Test FailureWebhook
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 FailureWebhook(
36+
account_id = '1234567',
37+
phone_number = '+18005555555',
38+
error_code = '400',
39+
error_description = 'cannot process request.',
40+
errors = [
41+
'optInWorkflowImageURLs: Entries must be a valid array of objects.'
42+
],
43+
internal_ticket_number = 'acde070d-8c4c-4f0d-9d8a-162843c10333'
44+
)
45+
else:
46+
return FailureWebhook(
47+
)
48+
49+
def testFailureWebhook(self):
50+
"""Test FailureWebhook"""
51+
instance = self.make_instance(True)
52+
assert instance is not None
53+
assert isinstance(instance, FailureWebhook)
54+
assert instance.account_id == '1234567'
55+
assert instance.phone_number == '+18005555555'
56+
assert instance.error_code == '400'
57+
assert instance.error_description == 'cannot process request.'
58+
assert isinstance(instance.errors, list)
59+
assert len(instance.errors) == 1
60+
assert instance.errors[0] == 'optInWorkflowImageURLs: Entries must be a valid array of objects.'
61+
assert instance.internal_ticket_number == 'acde070d-8c4c-4f0d-9d8a-162843c10333'
62+
63+
if __name__ == '__main__':
64+
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.links_object import LinksObject
19+
20+
class TestLinksObject(unittest.TestCase):
21+
"""LinksObject 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) -> LinksObject:
30+
"""Test LinksObject
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 LinksObject(
36+
first = 'https://api.com/abc/first',
37+
next = 'https://api.com/abc/next',
38+
previous = 'https://api.com/abc/previous',
39+
last = 'https://api.com/abc/last'
40+
)
41+
else:
42+
return LinksObject(
43+
)
44+
45+
def testLinksObject(self):
46+
"""Test LinksObject"""
47+
instance = self.make_instance(True)
48+
assert instance is not None
49+
assert isinstance(instance, LinksObject)
50+
assert instance.first == 'https://api.com/abc/first'
51+
assert instance.next == 'https://api.com/abc/next'
52+
assert instance.previous == 'https://api.com/abc/previous'
53+
assert instance.last == 'https://api.com/abc/last'
54+
55+
if __name__ == '__main__':
56+
unittest.main()

0 commit comments

Comments
 (0)