Skip to content

Commit

Permalink
VLTCLT-37: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
williamlardier committed Jan 23, 2024
1 parent 1ce5626 commit bf02904
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
5 changes: 2 additions & 3 deletions tests/unit/handleResponse.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
'use strict'; // eslint-disable-line
// const http = require('http');
const assert = require('assert');
const { errors } = require('arsenal');
const IAMClient = require('../../lib/IAMClient');
const { InternalError } = require('arsenal/build/lib/errors/arsenalErrors');

const log = { error() {} };
const res = { statusCode: 400 };
const ret = '<Response><Code>foo</Code></Response>';
const expErr = errors.InternalError
.customizeDescription('unable to translate error from vault');
const expErr = InternalError;

describe('handling unrecognized error syntax', () => {
let client;
Expand Down
15 changes: 11 additions & 4 deletions tests/unit/httpsTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ const httpPort = 8500;
const httpsPort = 8600;
const httpsPortTwoWay = 8601;

const defaultAccessKey = 'D4IT2AWSB588GO5J9T00';
const defaultSecretKey = 'UEEu8tYlsOGGrgf4DAiSZD6apVNPUWqRiPG0nTB6';

const accountName = 'account_name';
const accountOptions = { email: '[email protected]', password: 'pwd' };

Expand All @@ -39,14 +42,18 @@ const testNames = [
];

const testClients = [
new IAMClient('localhost', httpPort),
new IAMClient('localhost', httpPort, false),
new IAMClient('localhost', httpPort, undefined, undefined, undefined, undefined, undefined,
defaultAccessKey, defaultSecretKey),
new IAMClient('localhost', httpPort, false, undefined, undefined, undefined, undefined,
defaultAccessKey, defaultSecretKey),
new IAMClient('vault.testing.local', httpsPort, true, undefined, undefined,
fs.readFileSync('tests/utils/ca.crt', 'ascii')),
fs.readFileSync('tests/utils/ca.crt', 'ascii'), undefined,
defaultAccessKey, defaultSecretKey),
new IAMClient('vault.testing.local', httpsPortTwoWay, true,
fs.readFileSync('tests/utils/test.key', 'ascii'),
fs.readFileSync('tests/utils/test.crt', 'ascii'),
fs.readFileSync('tests/utils/ca.crt', 'ascii')),
fs.readFileSync('tests/utils/ca.crt', 'ascii'),
undefined, defaultAccessKey, defaultSecretKey),
];

function extractPost(req, cb) {
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/v2authTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ describe('v2 auth tests with mockup server', () => {
accessKeys[testIndex],
{ algo: hashAlgorithms[testIndex] },
(err, response) => {
assert.deepStrictEqual(err, expectedErrors[testIndex]);
assert.deepStrictEqual(err ? err.code : undefined,
expectedErrors[testIndex] ? expectedErrors[testIndex].type : undefined);
assert.deepStrictEqual(response
? response.message.body : response,
expectedResponseBodies[testIndex]);
Expand Down

0 comments on commit bf02904

Please sign in to comment.