Added missing MPC UTs

This commit is contained in:
Koushik-Ayila 2021-10-28 17:19:58 +05:30
parent 2124f19ad4
commit ceec752785
3 changed files with 92 additions and 1 deletions

View file

@ -883,6 +883,60 @@ export function Request(config) {
});
}
else if (method === 'POST' && action === 'MultiPartyCall/name_TestMPC/Participant/10/Record/'){
resolve({
response: {},
body: {
"api_id": "036c80f3-3721-11ec-a678-0242ac110002",
"message": "MPC: TestMPC participant record started",
"recording_id": "24670db8-c723-4ba2-8521-f10ec41ddf8b",
"recording_url": "https://media-qa.voice.plivodev.com/v1/Account/MAXXXXXXXXXXXX/Recording/XXXXX-XXXX-XXXX-XXXXX.mp3"
}
});
}
else if (method === 'DELETE' && action === 'MultiPartyCall/name_TestMPC/Participant/10/Record/'){
resolve({
response: {},
body: {}
});
}
else if (method === 'POST' && action === 'MultiPartyCall/name_TestMPC/Participant/10/Record/Pause/'){
resolve({
response: {},
body: {}
});
}
else if (method === 'POST' && action === 'MultiPartyCall/name_TestMPC/Participant/10/Record/Resume/'){
resolve({
response: {},
body: {}
});
}
else if (method === 'POST' && action === 'MultiPartyCall/name_TestMPC/Member/10/Play/'){
resolve({
response: {},
body: {
"api_id": "c07db813-3721-11ec-8bcd-0242ac110008",
"message": "play queued into MPC",
"mpcMemberId": [
"1003"
],
"mpcName": "TestMPC"
}
});
}
else if (method === 'DELETE' && action === 'MultiPartyCall/name_TestMPC/Member/10/Play/'){
resolve({
response: {},
body: {}
});
}
// ============= Numbers ===================
else if (method == 'GET' && action == 'Number/+919999999990/') {
resolve({

View file

@ -92,4 +92,41 @@ describe('multiPartyCalls', function (){
assert.equal(response.resourceUri, '/v1/Account/MAMDJMMTEZOWY0ZMQWM2/MultiPartyCall/uuid_7503f05f-2d6e-4ab3-b9e6-3b0d81ae9087/Participant/2132/')
})
});
it('should start MPC Participant Recording', function (){
return client.multiPartyCalls.startParticipantRecording(10, {friendlyName: 'TestMPC'}).then(function (response){
assert(response.message, "MPC: TestMPC participant record started")
})
});
it('should stop MPC Participant Recording', function (){
return client.multiPartyCalls.stopParticipantRecording(10,{friendlyName: 'TestMPC'}).then(function (response){
assert(response instanceof PlivoGenericResponse)
})
});
it('should pause MPC Participant Recording', function (){
return client.multiPartyCalls.pauseParticipantRecording(10,{friendlyName: 'TestMPC'}).then(function (response){
assert(response instanceof PlivoGenericResponse)
})
});
it('should resume MPC Participant Recording', function (){
return client.multiPartyCalls.resumeParticipantRecording(10,{friendlyName: 'TestMPC'}).then(function (response){
assert(response instanceof PlivoGenericResponse)
})
});
it('should start MPC Play Audio Member', function (){
return client.multiPartyCalls.startPlayAudio(10,'https://s3.amazonaws.com/XXX/XXX.mp3',
{friendlyName: 'TestMPC'}).then(function (response){
assert(response.message, "play queued into MPC")
})
});
it('should stop MPC Play Audio Member', function (){
return client.multiPartyCalls.stopPlayAudio(10,{friendlyName: 'TestMPC'}).then(function (response){
assert(response instanceof PlivoGenericResponse)
})
});
})

View file

@ -35,7 +35,7 @@ describe('PlivoXML', function () {
maxDuration: 1000,
statusCallbackEvents: 'participant-speak-events, participant-digit-input-events, add-participant-api-events, participant-state-changes, mpc-state-changes'
});
assert.equal('<Response><MultiPartyCall role="Agent" maxDuration="1000" statusCallbackEvents="participant-speak-events, participant-digit-input-events, add-participant-api-events, participant-state-changes, mpc-state-changes" maxParticipants="10" waitMusicMethod="GET" agentHoldMusicMethod="GET" customerHoldMusicMethod="GET" record="false" recordFileFormat="mp3" recordingCallbackMethod="GET" statusCallbackMethod="POST" stayAlone="false" coachMode="true" mute="false" hold="false" startMpcOnEnter="true" endMpcOnExit="false" enterSound="beep:1" enterSoundMethod="GET" exitSound="beep:2" exitSoundMethod="GET" onExitActionMethod="POST" relayDTMFInputs="false">Nairobi</MultiPartyCall></Response>',mpcResponse.toXML());
assert.equal('<Response><MultiPartyCall role="Agent" maxDuration="1000" statusCallbackEvents="participant-speak-events, participant-digit-input-events, add-participant-api-events, participant-state-changes, mpc-state-changes" maxParticipants="10" waitMusicMethod="GET" agentHoldMusicMethod="GET" customerHoldMusicMethod="GET" record="false" recordFileFormat="mp3" recordingCallbackMethod="GET" statusCallbackMethod="POST" stayAlone="false" coachMode="true" mute="false" hold="false" startMpcOnEnter="true" endMpcOnExit="false" enterSound="beep:1" enterSoundMethod="GET" exitSound="beep:2" exitSoundMethod="GET" onExitActionMethod="POST" relayDTMFInputs="false" startRecordingAudioMethod="GET" stopRecordingAudioMethod="GET">Nairobi</MultiPartyCall></Response>',mpcResponse.toXML());
done();
});
});