Add backups.testProviderConfig

fields like format/retention won't be validated here since it's only
testing the access credentials
This commit is contained in:
Girish Ramakrishnan
2019-12-05 11:55:51 -08:00
parent d57681ff21
commit a44a82083e
3 changed files with 13 additions and 2 deletions

View File

@@ -2,6 +2,7 @@
exports = module.exports = {
testConfig: testConfig,
testProviderConfig: testProviderConfig,
getByStatePaged: getByStatePaged,
getByAppIdPaged: getByAppIdPaged,
@@ -118,6 +119,17 @@ function testConfig(backupConfig, callback) {
api(backupConfig.provider).testConfig(backupConfig, callback);
}
function testProviderConfig(backupConfig, callback) {
assert.strictEqual(typeof backupConfig, 'object');
assert.strictEqual(typeof callback, 'function');
var func = api(backupConfig.provider);
if (!func) return callback(new BoxError(BoxError.BAD_FIELD, 'unknown storage provider', { field: 'provider' }));
api(backupConfig.provider).testConfig(backupConfig, callback);
}
function getByStatePaged(state, page, perPage, callback) {
assert.strictEqual(typeof state, 'string');
assert(typeof page === 'number' && page > 0);