Skip to content

Commit 208fb78

Browse files
Update test_calls.py
1 parent 8c9ba8b commit 208fb78

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

test/integration/test_calls.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -262,20 +262,25 @@ def test_update_call(self):
262262
fallback_password="mySecretPassword1!",
263263
tag="My Custom Tag",
264264
)
265+
body2 = UpdateCall(state=CallStateEnum("completed"));
265266

266267
time.sleep(2)
267268
update_call_response: UpdateCall = self.api_instance.update_call(BW_ACCOUNT_ID, call_id, body, _return_http_data_only=False)
268269

269270
self.assertEqual(update_call_response[1], 200)
270271

272+
# hanging-up the call
273+
update_call_response: UpdateCall = self.api_instance.update_call(BW_ACCOUNT_ID, call_id, body2, _return_http_data_only=False)
274+
self.assertEqual(update_call_response[1], 200)
275+
271276
def test_update_call_bad_request(self):
272277
"""Validate a bad (400) update call request
273278
"""
274-
answer_url = MANTECA_BASE_URL + "/bxml/loop"
279+
answer_url = MANTECA_BASE_URL + "/bxml/idle"
275280
call_body = CreateCall(to=MANTECA_IDLE_NUMBER, _from=MANTECA_ACTIVE_NUMBER, application_id=MANTECA_APPLICATION_ID, answer_url=answer_url)
276281
create_call_response: CreateCallResponse = self.api_instance.create_call(BW_ACCOUNT_ID, call_body, _return_http_data_only=False)
277282
call_id = create_call_response[0].call_id
278-
body = UpdateCall(state=CallStateEnum("active"))
283+
body = UpdateCall(state=CallStateEnum("completed"))
279284

280285
with self.assertRaises(ApiException) as context:
281286
self.api_instance.update_call(BW_ACCOUNT_ID, call_id, body, _return_http_data_only=False)
@@ -293,7 +298,7 @@ def test_update_call_unauthorized(self):
293298
unauthorized_api_instance = calls_api.CallsApi(
294299
unauthorized_api_client)
295300
call_id = "invalidCallId"
296-
body = UpdateCall(state=CallStateEnum("active"))
301+
body = UpdateCall(state=CallStateEnum("completed"))
297302

298303
with self.assertRaises(UnauthorizedException) as context:
299304
unauthorized_api_instance.update_call(BW_ACCOUNT_ID, call_id, body, _return_http_data_only=False)
@@ -312,11 +317,11 @@ def test_update_call_forbidden(self):
312317
forbidden_api_client = bandwidth.ApiClient(configuration)
313318
forbidden_api_instance = calls_api.CallsApi(
314319
forbidden_api_client)
315-
answer_url = MANTECA_BASE_URL + "/bxml/loop"
320+
answer_url = MANTECA_BASE_URL + "/bxml/idle"
316321
call_body = CreateCall(to=MANTECA_IDLE_NUMBER, _from=MANTECA_ACTIVE_NUMBER, application_id=MANTECA_APPLICATION_ID, answer_url=answer_url)
317322
create_call_response: CreateCallResponse = self.api_instance.create_call(BW_ACCOUNT_ID, call_body, _return_http_data_only=False)
318323
call_id = create_call_response[0].call_id
319-
body = UpdateCall(state=CallStateEnum("active"))
324+
body = UpdateCall(state=CallStateEnum("completed"))
320325

321326

322327
with self.assertRaises(ForbiddenException) as context:
@@ -351,10 +356,15 @@ def test_update_call_bxml(self):
351356

352357
self.assertEqual(update_call_bxml_response[1], 204)
353358

359+
# hanging-up the call
360+
body2 = UpdateCall(state=CallStateEnum("completed"))
361+
update_call_response: UpdateCall = self.api_instance.update_call(BW_ACCOUNT_ID, call_id, body2, _return_http_data_only=False)
362+
self.assertEqual(update_call_response[1], 200)
363+
354364
def test_update_call_bxml_bad_request(self):
355365
"""Validate a bad (400) update call bxml request
356366
"""
357-
answer_url = MANTECA_BASE_URL + "/bxml/loop"
367+
answer_url = MANTECA_BASE_URL + "/bxml/idle"
358368
call_body = CreateCall(to=MANTECA_IDLE_NUMBER, _from=MANTECA_ACTIVE_NUMBER, application_id=MANTECA_APPLICATION_ID, answer_url=answer_url)
359369
create_call_response: CreateCallResponse = self.api_instance.create_call(BW_ACCOUNT_ID, call_body, _return_http_data_only=False)
360370
call_id = create_call_response[0].call_id
@@ -396,7 +406,7 @@ def test_update_call_bxml_forbidden(self):
396406
forbidden_api_client = bandwidth.ApiClient(configuration)
397407
forbidden_api_instance = calls_api.CallsApi(
398408
forbidden_api_client)
399-
answer_url = MANTECA_BASE_URL + "/bxml/loop"
409+
answer_url = MANTECA_BASE_URL + "/bxml/idle"
400410
call_body = CreateCall(to=MANTECA_IDLE_NUMBER, _from=MANTECA_ACTIVE_NUMBER, application_id=MANTECA_APPLICATION_ID, answer_url=answer_url)
401411
create_call_response: CreateCallResponse = self.api_instance.create_call(BW_ACCOUNT_ID, call_body, _return_http_data_only=False)
402412
call_id = create_call_response[0].call_id

0 commit comments

Comments
 (0)