Skip to content

Commit

Permalink
Merge branch 'SWI-3688' of https://github.com/Bandwidth/node-sdk into…
Browse files Browse the repository at this point in the history
… SWI-3689
  • Loading branch information
ckoegel committed Oct 27, 2023
2 parents 72f5133 + 2431827 commit a808545
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ module.exports = {
'MANTECA_IDLE_NUMBER': process.env.MANTECA_IDLE_NUMBER,
'MANTECA_ACTIVE_NUMBER': process.env.MANTECA_ACTIVE_NUMBER,
'MANTECA_BASE_URL': process.env.MANTECA_BASE_URL,
'FORBIDDEN_USERNAME': process.env.BW_USERNAME_FORBIDDEN,
'FORBIDDEN_PASSWORD': process.env.BW_PASSWORD_FORBIDDEN,
'UNAUTHORIZED_USERNAME': 'bad_username',
'UNAUTHORIZED_PASSWORD': 'bad_password',
'MAX_RETRIES': 40,
Expand Down
11 changes: 11 additions & 0 deletions tests/integration/calls-api.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,17 @@ describe('CallsApi', () => {
}
});

test('403', async () => {
const configBad = new Configuration({username: FORBIDDEN_USERNAME, password: FORBIDDEN_PASSWORD});
const callsApiBad = new CallsApi(configBad);

try {
await callsApiBad.getCallState(BW_ACCOUNT_ID, callId);
} catch (e) {
expect(e.response.status).toEqual(403);
}
});

test('404', async () => {
try {
await callsApi.getCallState(BW_ACCOUNT_ID, 'does-not-exist');
Expand Down
11 changes: 11 additions & 0 deletions tests/integration/statistics-api.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,16 @@ describe('StatisticsApi', () => {
expect(e.response.status).toEqual(401);
}
});

test('403', async () => {
const configBad = new Configuration({username: FORBIDDEN_USERNAME, password: FORBIDDEN_PASSWORD});
const statisticsApiBad = new StatisticsApi(configBad);

try {
await statisticsApiBad.getStatistics(BW_ACCOUNT_ID);
} catch (e) {
expect(e.response.status).toEqual(403);
}
});
});
});

0 comments on commit a808545

Please sign in to comment.