From ba86ac19e6819ce32bc1f0b735ec5393d5b028e2 Mon Sep 17 00:00:00 2001 From: Sina Madani Date: Thu, 27 Jun 2024 15:52:35 +0100 Subject: [PATCH] test: createCall response assertions --- src/test/kotlin/com/vonage/client/kt/VoiceTest.kt | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/test/kotlin/com/vonage/client/kt/VoiceTest.kt b/src/test/kotlin/com/vonage/client/kt/VoiceTest.kt index ba90f42..8481332 100644 --- a/src/test/kotlin/com/vonage/client/kt/VoiceTest.kt +++ b/src/test/kotlin/com/vonage/client/kt/VoiceTest.kt @@ -210,6 +210,8 @@ class VoiceTest : AbstractTest() { val eventMethod = HttpMethod.POST val amdBehaviour = MachineDetection.HANGUP val amdMode = AdvancedMachineDetection.Mode.DETECT_BEEP + val callStatus = CallStatus.RINGING + val callDirection = CallDirection.OUTBOUND val wsContentType = "audio/l16;rate=8000" val dtmf = "p*123#" val vbcExt = "4321" @@ -257,12 +259,12 @@ class VoiceTest : AbstractTest() { "ringing_timer" to ringingTimer ), status = 201, expectedResponseParams = mapOf( "uuid" to callIdStr, - "status" to "ringing", - "direction" to "outbound", + "status" to callStatus.name.lowercase(), + "direction" to callDirection.name.lowercase(), "conversation_uuid" to conversationId )) - voiceClient.createCall { + val callEvent = voiceClient.createCall { answerUrl(answerUrl); answerMethod(answerMethod) from(fromPstn); fromRandomNumber(false); eventUrl(eventUrl); eventMethod(eventMethod) @@ -276,5 +278,11 @@ class VoiceTest : AbstractTest() { SipEndpoint(sipUri, customHeaders, userToUserHeader) ) } + + assertNotNull(callEvent) + assertEquals(callIdStr, callEvent.uuid) + assertEquals(callStatus, callEvent.status) + assertEquals(callDirection, callEvent.direction) + assertEquals(conversationId, callEvent.conversationUuid) } } \ No newline at end of file