2222from bandwidth .api .endpoints_api import EndpointsApi
2323from bandwidth .models .create_web_rtc_connection_request import CreateWebRtcConnectionRequest
2424from bandwidth .models .create_endpoint_response import CreateEndpointResponse
25+ from bandwidth .models .create_endpoint_response_data import CreateEndpointResponseData
2526from bandwidth .models .endpoint_response import EndpointResponse
27+ from bandwidth .models .endpoint import Endpoint
28+ from bandwidth .models .endpoints import Endpoints
2629from bandwidth .models .list_endpoints_response import ListEndpointsResponse
30+ from bandwidth .models .link import Link
31+ from bandwidth .models .page import Page
2732from bandwidth .models .endpoint_type_enum import EndpointTypeEnum
2833from bandwidth .models .endpoint_direction_enum import EndpointDirectionEnum
2934from bandwidth .models .endpoint_status_enum import EndpointStatusEnum
@@ -66,8 +71,21 @@ def test_create_endpoint(self) -> None:
6671
6772 assert_that (response .status_code , equal_to (201 ))
6873 assert_that (response .data , instance_of (CreateEndpointResponse ))
74+
6975 assert_that (response .data .links , instance_of (list ))
70- assert_that (response .data .data , instance_of (object ))
76+ assert_that (len (response .data .links ), greater_than (0 ))
77+ assert_that (response .data .links [0 ], instance_of (Link ))
78+ assert_that (response .data .links [0 ].href , starts_with ('http' ))
79+ assert_that (response .data .links [0 ].rel , instance_of (str ))
80+
81+ assert_that (response .data .data , instance_of (CreateEndpointResponseData ))
82+ assert_that (response .data .data .endpoint_id , instance_of (str ))
83+ assert_that (response .data .data .type , is_in (EndpointTypeEnum ))
84+ assert_that (response .data .data .status , is_in (EndpointStatusEnum ))
85+ assert_that (response .data .data .creation_timestamp , instance_of (datetime ))
86+ assert_that (response .data .data .expiration_timestamp , instance_of (datetime ))
87+ assert_that (response .data .data .token , instance_of (str ))
88+
7189 assert_that (response .data .errors , instance_of (list ))
7290
7391 def test_delete_endpoint (self ) -> None :
@@ -94,8 +112,20 @@ def test_get_endpoint(self) -> None:
94112
95113 assert_that (response .status_code , equal_to (200 ))
96114 assert_that (response .data , instance_of (EndpointResponse ))
115+
97116 assert_that (response .data .links , instance_of (list ))
98- assert_that (response .data .data , instance_of (object ))
117+ assert_that (len (response .data .links ), greater_than (0 ))
118+ assert_that (response .data .links [0 ], instance_of (Link ))
119+ assert_that (response .data .links [0 ].href , starts_with ('http' ))
120+ assert_that (response .data .links [0 ].rel , instance_of (str ))
121+
122+ assert_that (response .data .data , instance_of (Endpoint ))
123+ assert_that (response .data .data .endpoint_id , instance_of (str ))
124+ assert_that (response .data .data .type , is_in (EndpointTypeEnum ))
125+ assert_that (response .data .data .status , is_in (EndpointStatusEnum ))
126+ assert_that (response .data .data .creation_timestamp , instance_of (datetime ))
127+ assert_that (response .data .data .expiration_timestamp , instance_of (datetime ))
128+
99129 assert_that (response .data .errors , instance_of (list ))
100130
101131 def test_list_endpoints (self ) -> None :
@@ -109,98 +139,29 @@ def test_list_endpoints(self) -> None:
109139
110140 assert_that (response .status_code , equal_to (200 ))
111141 assert_that (response .data , instance_of (ListEndpointsResponse ))
112- assert_that (response .data .links , instance_of (list ))
113- assert_that (response .data .data , instance_of (list ))
114- assert_that (response .data .errors , instance_of (list ))
115-
116- def test_list_endpoints_with_filters (self ) -> None :
117- """Test case for list_endpoints with filters
118-
119- List Endpoints with Type and Status Filters
120- """
121- response = self .endpoints_api_instance .list_endpoints_with_http_info (
122- BW_ACCOUNT_ID ,
123- type = EndpointTypeEnum .WEBRTC ,
124- status = EndpointStatusEnum .CONNECTED ,
125- limit = 100
126- )
127142
128- assert_that (response .status_code , equal_to (200 ))
129- assert_that (response .data , instance_of (ListEndpointsResponse ))
130143 assert_that (response .data .links , instance_of (list ))
131- assert_that (response .data .data , instance_of (list ))
132- assert_that (response .data .errors , instance_of (list ))
133- if response .data .page :
134- assert_that (response .data .page , instance_of (object ))
135-
136- def test_list_endpoints_with_pagination (self ) -> None :
137- """Test case for list_endpoints with pagination
144+ assert_that (len (response .data .links ), greater_than (0 ))
145+ assert_that (response .data .links [0 ], instance_of (Link ))
146+ assert_that (response .data .links [0 ].href , starts_with ('http' ))
147+ assert_that (response .data .links [0 ].rel , instance_of (str ))
138148
139- List Endpoints with Pagination
140- """
141- response = self .endpoints_api_instance .list_endpoints_with_http_info (
142- BW_ACCOUNT_ID ,
143- after_cursor = "cursor-abc123" ,
144- limit = 50
145- )
146-
147- assert_that (response .status_code , equal_to (200 ))
148- assert_that (response .data , instance_of (ListEndpointsResponse ))
149- assert_that (response .data .links , instance_of (list ))
150149 assert_that (response .data .data , instance_of (list ))
151- assert_that (response .data .errors , instance_of (list ))
150+ assert_that (len (response .data .data ), greater_than (0 ))
151+ assert_that (response .data .data [0 ], instance_of (Endpoints ))
152+ assert_that (response .data .data [0 ].endpoint_id , instance_of (str ))
153+ assert_that (response .data .data [0 ].type , is_in (EndpointTypeEnum ))
154+ assert_that (response .data .data [0 ].status , is_in (EndpointStatusEnum ))
155+ assert_that (response .data .data [0 ].creation_timestamp , instance_of (datetime ))
156+ assert_that (response .data .data [0 ].expiration_timestamp , instance_of (datetime ))
152157
153- # TODO: Endpoint BXML not ready yet - commented out
154- # def test_update_endpoint_bxml(self) -> None:
155- # """Test case for update_endpoint_bxml
156- #
157- # Update Endpoint BXML
158- # """
159- # update_bxml = '<?xml version="1.0" encoding="UTF-8"?><Bxml><SpeakSentence locale="en_US" gender="female" voice="susan">This is a test bxml response for endpoint</SpeakSentence><Pause duration="3"/></Bxml>'
160- #
161- # response = self.endpoints_api_instance.update_endpoint_bxml_with_http_info(
162- # BW_ACCOUNT_ID,
163- # "ep-abc123",
164- # update_bxml
165- # )
166- #
167- # assert_that(response.status_code, equal_to(204))
168-
169- def test_create_endpoint_minimal (self ) -> None :
170- """Test case for create_endpoint with minimal required fields
171-
172- Create Endpoint with Minimal Fields
173- """
174- endpoint_body = CreateWebRtcConnectionRequest (
175- type = EndpointTypeEnum .WEBRTC ,
176- direction = EndpointDirectionEnum .OUTBOUND
177- )
178- response = self .endpoints_api_instance .create_endpoint_with_http_info (
179- BW_ACCOUNT_ID ,
180- endpoint_body
181- )
182-
183- assert_that (response .status_code , equal_to (201 ))
184- assert_that (response .data , instance_of (CreateEndpointResponse ))
158+ if response .data .page :
159+ assert_that (response .data .page , instance_of (Page ))
160+ assert_that (response .data .page .page_size , greater_than_or_equal_to (0 ))
185161
186- def test_create_endpoint_sip (self ) -> None :
187- """Test case for create_endpoint with SIP type
162+ assert_that (response .data .errors , instance_of (list ))
188163
189- Create SIP Endpoint
190- """
191- endpoint_body = CreateWebRtcConnectionRequest (
192- type = EndpointTypeEnum .WEBRTC ,
193- direction = EndpointDirectionEnum .BIDIRECTIONAL ,
194- event_callback_url = "https://myServer.com/bandwidth/webhooks/sip-endpoint" ,
195- tag = "sip-test-endpoint"
196- )
197- response = self .endpoints_api_instance .create_endpoint_with_http_info (
198- BW_ACCOUNT_ID ,
199- endpoint_body
200- )
201164
202- assert_that (response .status_code , equal_to (201 ))
203- assert_that (response .data , instance_of (CreateEndpointResponse ))
204165
205166
206167if __name__ == '__main__' :
0 commit comments