-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
VaultClientWrapper fallback to auth config when vaultadmin config not…
… defined Issue: BB-622
- Loading branch information
Showing
6 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
'use strict'; // eslint-disable-line | ||
|
||
const assert = require('assert'); | ||
const sinon = require('sinon'); | ||
|
||
const FakeLogger = require('../../utils/fakeLogger'); | ||
const VaultClientWrapper = require('../../../extensions/utils/VaultClientWrapper'); | ||
const { errors } = require('arsenal'); | ||
|
||
describe('VaultClientWrapper', () => { | ||
afterEach(() => { | ||
sinon.restore(); | ||
}); | ||
|
||
describe('constructor', () => { | ||
it('should fallback to authConfig vault if vaultConf is not provided', () => { | ||
const vaultClientWrapper = new VaultClientWrapper( | ||
'id', | ||
undefined, | ||
{ type: 'none', vault: { host: '127.0.0.1', port: 8500 } }, | ||
FakeLogger, | ||
); | ||
assert.strictEqual(vaultClientWrapper._vaultConf.host, '127.0.0.1'); | ||
assert.strictEqual(vaultClientWrapper._vaultConf.port, 8500); | ||
}); | ||
|
||
it('should throw an error if vault configuration is missing', () => { | ||
assert.throws(() => | ||
new VaultClientWrapper('id', undefined, { type: 'none' }, FakeLogger), | ||
); | ||
}); | ||
}); | ||
|
||
}); |