Skip to content

Commit 556af4e

Browse files
committed
update tests
1 parent 242a0e4 commit 556af4e

10 files changed

Lines changed: 123 additions & 121 deletions

test/unit/api/test_endpoints_api.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from bandwidth.models.endpoint import Endpoint
2828
from bandwidth.models.endpoints import Endpoints
2929
from bandwidth.models.list_endpoints_response import ListEndpointsResponse
30-
from bandwidth.models.link import Link
30+
from bandwidth.models.brtc_link import BrtcLink
3131
from bandwidth.models.page import Page
3232
from bandwidth.models.endpoint_type_enum import EndpointTypeEnum
3333
from bandwidth.models.endpoint_direction_enum import EndpointDirectionEnum
@@ -73,7 +73,7 @@ def test_create_endpoint(self) -> None:
7373
assert_that(response.data, instance_of(CreateEndpointResponse))
7474

7575
assert_that(response.data.links, instance_of(list))
76-
assert_that(response.data.links[0], instance_of(Link))
76+
assert_that(response.data.links[0], instance_of(BrtcLink))
7777
assert_that(response.data.links[0].href, starts_with('http'))
7878
assert_that(response.data.links[0].rel, equal_to('endpoint'))
7979

@@ -115,7 +115,7 @@ def test_get_endpoint(self) -> None:
115115
assert_that(response.data, instance_of(EndpointResponse))
116116

117117
assert_that(response.data.links, instance_of(list))
118-
assert_that(response.data.links[0], instance_of(Link))
118+
assert_that(response.data.links[0], instance_of(BrtcLink))
119119
assert_that(response.data.links[0].href, starts_with('http'))
120120
assert_that(response.data.links[0].rel, equal_to('self'))
121121

@@ -143,7 +143,7 @@ def test_list_endpoints(self) -> None:
143143
assert_that(response.data, instance_of(ListEndpointsResponse))
144144

145145
assert_that(response.data.links, instance_of(list))
146-
assert_that(response.data.links[0], instance_of(Link))
146+
assert_that(response.data.links[0], instance_of(BrtcLink))
147147
assert_that(response.data.links[0].href, starts_with('http'))
148148
assert_that(response.data.links[0].rel, equal_to('self'))
149149

test/unit/models/test_brtc_error.py

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414

1515

1616
import unittest
17+
from uuid import UUID
1718

1819
from bandwidth.models.brtc_error import BrtcError
20+
from bandwidth.models.brtc_error_source import BrtcErrorSource
1921

2022
class TestBrtcError(unittest.TestCase):
2123
"""BrtcError unit test stubs"""
@@ -31,32 +33,39 @@ def make_instance(self, include_optional) -> BrtcError:
3133
include_optional is a boolean, when False only required
3234
params are included, when True both required and
3335
optional params are included """
34-
# uncomment below to create an instance of `BrtcError`
35-
"""
36-
model = BrtcError()
3736
if include_optional:
3837
return BrtcError(
39-
id = '59512d87-7a92-4040-8e4a-78fb772019b9',
40-
type = 'resource.not_found',
41-
description = 'The requested resource was not found.',
42-
code = '404',
43-
source = bandwidth.models.brtc_error_source.brtcErrorSource(
44-
parameter = 'accountId',
45-
field = 'accountId',
46-
header = 'Authorization',
47-
reference = 'e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85', )
38+
id='59512d87-7a92-4040-8e4a-78fb772019b9',
39+
type='resource.not_found',
40+
description='The requested resource was not found.',
41+
code='404',
42+
source=BrtcErrorSource(
43+
parameter='accountId',
44+
var_field='accountId',
45+
header='Authorization',
46+
reference='e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85'
47+
)
4848
)
4949
else:
5050
return BrtcError(
51-
type = 'resource.not_found',
52-
description = 'The requested resource was not found.',
53-
)
54-
"""
51+
type='resource.not_found',
52+
description='The requested resource was not found.'
53+
)
5554

5655
def testBrtcError(self):
5756
"""Test BrtcError"""
58-
# inst_req_only = self.make_instance(include_optional=False)
59-
# inst_req_and_optional = self.make_instance(include_optional=True)
57+
instance = self.make_instance(True)
58+
assert instance is not None
59+
assert isinstance(instance, BrtcError)
60+
assert isinstance(instance.id, UUID)
61+
assert instance.type == 'resource.not_found'
62+
assert instance.description == 'The requested resource was not found.'
63+
assert instance.code == '404'
64+
assert isinstance(instance.source, BrtcErrorSource)
65+
assert instance.source.parameter == 'accountId'
66+
assert instance.source.var_field == 'accountId'
67+
assert instance.source.header == 'Authorization'
68+
assert instance.source.reference == 'e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85'
6069

6170
if __name__ == '__main__':
6271
unittest.main()

test/unit/models/test_brtc_error_response.py

Lines changed: 36 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
import unittest
1717

1818
from bandwidth.models.brtc_error_response import BrtcErrorResponse
19+
from bandwidth.models.brtc_error import BrtcError
20+
from bandwidth.models.brtc_link import BrtcLink
1921

2022
class TestBrtcErrorResponse(unittest.TestCase):
2123
"""BrtcErrorResponse unit test stubs"""
@@ -31,59 +33,48 @@ def make_instance(self, include_optional) -> BrtcErrorResponse:
3133
include_optional is a boolean, when False only required
3234
params are included, when True both required and
3335
optional params are included """
34-
# uncomment below to create an instance of `BrtcErrorResponse`
35-
"""
36-
model = BrtcErrorResponse()
3736
if include_optional:
3837
return BrtcErrorResponse(
39-
links = [
40-
bandwidth.models.brtc_link.brtcLink(
41-
href = 'https://api.bandwidth.com/v2/accounts/5500123/endpoints/e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
42-
rel = 'self',
43-
method = 'GET', )
44-
],
45-
data = None,
46-
errors = [
47-
bandwidth.models.brtc_error.brtcError(
48-
id = '59512d87-7a92-4040-8e4a-78fb772019b9',
49-
type = 'resource.not_found',
50-
description = 'The requested resource was not found.',
51-
code = '404',
52-
source = bandwidth.models.brtc_error_source.brtcErrorSource(
53-
parameter = 'accountId',
54-
field = 'accountId',
55-
header = 'Authorization',
56-
reference = 'e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85', ), )
57-
]
38+
links=[
39+
BrtcLink(
40+
href='https://api.bandwidth.com/v2/accounts/5500123/endpoints/e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
41+
rel='self',
42+
method='GET'
43+
)
44+
],
45+
data=None,
46+
errors=[
47+
BrtcError(
48+
id='59512d87-7a92-4040-8e4a-78fb772019b9',
49+
type='resource.not_found',
50+
description='The requested resource was not found.',
51+
code='404'
52+
)
53+
]
5854
)
5955
else:
6056
return BrtcErrorResponse(
61-
links = [
62-
bandwidth.models.brtc_link.brtcLink(
63-
href = 'https://api.bandwidth.com/v2/accounts/5500123/endpoints/e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
64-
rel = 'self',
65-
method = 'GET', )
66-
],
67-
data = None,
68-
errors = [
69-
bandwidth.models.brtc_error.brtcError(
70-
id = '59512d87-7a92-4040-8e4a-78fb772019b9',
71-
type = 'resource.not_found',
72-
description = 'The requested resource was not found.',
73-
code = '404',
74-
source = bandwidth.models.brtc_error_source.brtcErrorSource(
75-
parameter = 'accountId',
76-
field = 'accountId',
77-
header = 'Authorization',
78-
reference = 'e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85', ), )
79-
],
80-
)
81-
"""
57+
links=[],
58+
data=None,
59+
errors=[]
60+
)
8261

8362
def testBrtcErrorResponse(self):
8463
"""Test BrtcErrorResponse"""
85-
# inst_req_only = self.make_instance(include_optional=False)
86-
# inst_req_and_optional = self.make_instance(include_optional=True)
64+
instance = self.make_instance(True)
65+
assert instance is not None
66+
assert isinstance(instance, BrtcErrorResponse)
67+
assert isinstance(instance.links, list)
68+
assert len(instance.links) == 1
69+
assert isinstance(instance.links[0], BrtcLink)
70+
assert instance.links[0].href == 'https://api.bandwidth.com/v2/accounts/5500123/endpoints/e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85'
71+
assert instance.links[0].rel == 'self'
72+
assert instance.data is None
73+
assert isinstance(instance.errors, list)
74+
assert len(instance.errors) == 1
75+
assert isinstance(instance.errors[0], BrtcError)
76+
assert instance.errors[0].type == 'resource.not_found'
77+
assert instance.errors[0].description == 'The requested resource was not found.'
8778

8879
if __name__ == '__main__':
8980
unittest.main()

test/unit/models/test_brtc_error_source.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
from bandwidth.models.brtc_error_source import BrtcErrorSource
1919

20+
2021
class TestBrtcErrorSource(unittest.TestCase):
2122
"""BrtcErrorSource unit test stubs"""
2223

@@ -31,25 +32,25 @@ def make_instance(self, include_optional) -> BrtcErrorSource:
3132
include_optional is a boolean, when False only required
3233
params are included, when True both required and
3334
optional params are included """
34-
# uncomment below to create an instance of `BrtcErrorSource`
35-
"""
36-
model = BrtcErrorSource()
3735
if include_optional:
3836
return BrtcErrorSource(
39-
parameter = 'accountId',
40-
var_field = 'accountId',
41-
header = 'Authorization',
42-
reference = 'e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85'
37+
parameter='accountId',
38+
var_field='accountId',
39+
header='Authorization',
40+
reference='e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85'
4341
)
4442
else:
45-
return BrtcErrorSource(
46-
)
47-
"""
43+
return BrtcErrorSource()
4844

4945
def testBrtcErrorSource(self):
5046
"""Test BrtcErrorSource"""
51-
# inst_req_only = self.make_instance(include_optional=False)
52-
# inst_req_and_optional = self.make_instance(include_optional=True)
47+
instance = self.make_instance(True)
48+
assert instance is not None
49+
assert isinstance(instance, BrtcErrorSource)
50+
assert instance.parameter == 'accountId'
51+
assert instance.var_field == 'accountId'
52+
assert instance.header == 'Authorization'
53+
assert instance.reference == 'e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85'
5354

5455
if __name__ == '__main__':
5556
unittest.main()

test/unit/models/test_brtc_link.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,23 @@ def make_instance(self, include_optional) -> BrtcLink:
3131
include_optional is a boolean, when False only required
3232
params are included, when True both required and
3333
optional params are included """
34-
# uncomment below to create an instance of `BrtcLink`
35-
"""
36-
model = BrtcLink()
3734
if include_optional:
3835
return BrtcLink(
39-
href = 'https://api.bandwidth.com/v2/accounts/5500123/endpoints/e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
40-
rel = 'self',
41-
method = 'GET'
36+
href='https://api.bandwidth.com/v2/accounts/5500123/endpoints/e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85',
37+
rel='self',
38+
method='GET'
4239
)
4340
else:
44-
return BrtcLink(
45-
)
46-
"""
41+
return BrtcLink()
4742

4843
def testBrtcLink(self):
4944
"""Test BrtcLink"""
50-
# inst_req_only = self.make_instance(include_optional=False)
51-
# inst_req_and_optional = self.make_instance(include_optional=True)
45+
instance = self.make_instance(True)
46+
assert instance is not None
47+
assert isinstance(instance, BrtcLink)
48+
assert instance.href == 'https://api.bandwidth.com/v2/accounts/5500123/endpoints/e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85'
49+
assert instance.rel == 'self'
50+
assert instance.method == 'GET'
5251

5352
if __name__ == '__main__':
5453
unittest.main()

test/unit/models/test_create_endpoint_response.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
from bandwidth.models.create_endpoint_response import CreateEndpointResponse
2020
from bandwidth.models.create_endpoint_response_data import CreateEndpointResponseData
21-
from bandwidth.models.link import Link
22-
from bandwidth.models.error import Error
21+
from bandwidth.models.brtc_link import BrtcLink
22+
from bandwidth.models.brtc_error import BrtcError
2323
from bandwidth.models.endpoint_status_enum import EndpointStatusEnum
2424
from bandwidth.models.endpoint_type_enum import EndpointTypeEnum
2525

@@ -40,7 +40,7 @@ def make_instance(self, include_optional) -> CreateEndpointResponse:
4040
if include_optional:
4141
return CreateEndpointResponse(
4242
links=[
43-
Link(href='https://api.bandwidth.com/endpoint-123', rel='self')
43+
BrtcLink(href='https://api.bandwidth.com/endpoint-123', rel='self')
4444
],
4545
data=CreateEndpointResponseData(
4646
endpoint_id='endpoint-123',
@@ -63,7 +63,7 @@ def testCreateEndpointResponse(self):
6363
assert isinstance(instance, CreateEndpointResponse)
6464
assert isinstance(instance.links, list)
6565
assert len(instance.links) == 1
66-
assert isinstance(instance.links[0], Link)
66+
assert isinstance(instance.links[0], BrtcLink)
6767
assert isinstance(instance.data, CreateEndpointResponseData)
6868
assert instance.data.endpoint_id == 'endpoint-123'
6969
assert instance.data.token == 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.test.token'

test/unit/models/test_endpoint_response.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
from bandwidth.models.endpoint_response import EndpointResponse
2020
from bandwidth.models.endpoint import Endpoint
21-
from bandwidth.models.link import Link
22-
from bandwidth.models.error import Error
21+
from bandwidth.models.brtc_link import BrtcLink
22+
from bandwidth.models.brtc_error import BrtcError
2323
from bandwidth.models.endpoint_status_enum import EndpointStatusEnum
2424
from bandwidth.models.endpoint_type_enum import EndpointTypeEnum
2525

@@ -40,7 +40,7 @@ def make_instance(self, include_optional) -> EndpointResponse:
4040
if include_optional:
4141
return EndpointResponse(
4242
links=[
43-
Link(href='https://api.bandwidth.com/endpoint-999', rel='self')
43+
BrtcLink(href='https://api.bandwidth.com/endpoint-999', rel='self')
4444
],
4545
data=Endpoint(
4646
endpoint_id='endpoint-999',
@@ -62,7 +62,7 @@ def testEndpointResponse(self):
6262
assert isinstance(instance, EndpointResponse)
6363
assert isinstance(instance.links, list)
6464
assert len(instance.links) == 1
65-
assert isinstance(instance.links[0], Link)
65+
assert isinstance(instance.links[0], BrtcLink)
6666
assert isinstance(instance.data, Endpoint)
6767
assert instance.data.endpoint_id == 'endpoint-999'
6868
assert instance.data.type == EndpointTypeEnum.WEBRTC

test/unit/models/test_list_endpoints_response.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
from bandwidth.models.list_endpoints_response import ListEndpointsResponse
2020
from bandwidth.models.endpoints import Endpoints
21-
from bandwidth.models.link import Link
22-
from bandwidth.models.error import Error
21+
from bandwidth.models.brtc_link import BrtcLink
22+
from bandwidth.models.brtc_error import BrtcError
2323
from bandwidth.models.page import Page
2424
from bandwidth.models.endpoint_status_enum import EndpointStatusEnum
2525
from bandwidth.models.endpoint_type_enum import EndpointTypeEnum
@@ -41,8 +41,8 @@ def make_instance(self, include_optional) -> ListEndpointsResponse:
4141
if include_optional:
4242
return ListEndpointsResponse(
4343
links=[
44-
Link(href='https://api.bandwidth.com/endpoints', rel='self'),
45-
Link(href='https://api.bandwidth.com/endpoints?page=2', rel='next')
44+
BrtcLink(href='https://api.bandwidth.com/endpoints', rel='self'),
45+
BrtcLink(href='https://api.bandwidth.com/endpoints?page=2', rel='next')
4646
],
4747
page=Page(
4848
page_size=10,

0 commit comments

Comments
 (0)