Skip to content

Commit

Permalink
fix cannot update verbio engine_version (#327)
Browse files Browse the repository at this point in the history
  • Loading branch information
xquanluu authored Jun 4, 2024
1 parent d33d0aa commit 6041b1d
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/routes/api/speech-credentials.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ router.put('/:sid', async(req, res) => {
options,
deepgram_stt_uri,
deepgram_stt_use_tls,
engine_version
} = req.body;

const newCred = {
Expand All @@ -484,6 +485,7 @@ router.put('/:sid', async(req, res) => {
options,
deepgram_stt_uri,
deepgram_stt_use_tls,
engine_version
};
logger.info({o, newCred}, 'updating speech credential with this new credential');
obj.credential = encryptCredential(newCred);
Expand Down
54 changes: 53 additions & 1 deletion test/speech-credentials.js
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ test('speech credentials tests', async(t) => {
json: true,
body: {
vendor: 'aws',
labe: 'aws_polly_with_arn',
label: 'aws_polly_with_arn',
use_for_tts: true,
use_for_stt: false,
role_arn: 'Arn::aws::role',
Expand All @@ -767,6 +767,58 @@ test('speech credentials tests', async(t) => {
});
t.ok(result.statusCode === 204, 'successfully deleted speech credential');

/* add a credential for verbio */
result = await request.post(`/Accounts/${account_sid}/SpeechCredentials`, {
resolveWithFullResponse: true,
auth: authUser,
json: true,
body: {
vendor: 'verbio',
use_for_tts: true,
use_for_stt: true,
client_id: 'client:id',
client_secret: 'client:secret',
engine_version: 'V1'
}
});
t.ok(result.statusCode === 201, 'successfully added speech credential for Verbio');
const verbioSid = result.body.sid;

result = await request.get(`/Accounts/${account_sid}/SpeechCredentials/${verbioSid}`, {
resolveWithFullResponse: true,
simple: false,
auth: authAdmin,
json: true,
});
t.ok(result.body.engine_version === "V1", 'successfully get verbio speech credential');

result = await request.put(`/Accounts/${account_sid}/SpeechCredentials/${verbioSid}`, {
resolveWithFullResponse: true,
auth: authUser,
json: true,
body: {
use_for_tts: true,
use_for_stt: true,
engine_version: 'V2'
}
});
t.ok(result.statusCode === 204, 'successfully updated speech credential for verbio');

result = await request.get(`/Accounts/${account_sid}/SpeechCredentials/${verbioSid}`, {
resolveWithFullResponse: true,
simple: false,
auth: authAdmin,
json: true,
});
t.ok(result.body.engine_version === "V2", 'successfully Updated verbio speech credential');

/* delete the credential */
result = await request.delete(`/Accounts/${account_sid}/SpeechCredentials/${verbioSid}`, {
auth: authUser,
resolveWithFullResponse: true,
});
t.ok(result.statusCode === 204, 'successfully deleted speech credential');

/* Check google supportedLanguagesAndVoices */
result = await request.get(`/Accounts/${account_sid}/SpeechCredentials/speech/supportedLanguagesAndVoices?vendor=google`, {
resolveWithFullResponse: true,
Expand Down

0 comments on commit 6041b1d

Please sign in to comment.