rename backups to backuptargets
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
'use strict';
|
||||
|
||||
const backupListing = require('../backuplisting.js'),
|
||||
backups = require('../backups.js'),
|
||||
backupTargets = require('../backuptargets.js'),
|
||||
BoxError = require('../boxerror.js'),
|
||||
common = require('./common.js'),
|
||||
expect = require('expect.js'),
|
||||
@@ -123,37 +123,37 @@ describe('backups', function () {
|
||||
|
||||
describe('config and policy', function () {
|
||||
it('can get backup config', async function () {
|
||||
const backupConfig = await backups.getConfig();
|
||||
const backupConfig = await backupTargets.getConfig();
|
||||
expect(backupConfig.provider).to.be('filesystem');
|
||||
expect(backupConfig.backupFolder).to.be('/var/backups');
|
||||
});
|
||||
|
||||
it('can set backup config', async function () {
|
||||
let backupConfig = await backups.getConfig();
|
||||
let backupConfig = await backupTargets.getConfig();
|
||||
backupConfig = Object.assign({}, backupConfig, { backupFolder: '/tmp/backups' });
|
||||
await backups.setConfig(backupConfig);
|
||||
await backupTargets.setConfig(backupConfig);
|
||||
|
||||
const newBackupConfig = await backups.getConfig();
|
||||
const newBackupConfig = await backupTargets.getConfig();
|
||||
expect(newBackupConfig.backupFolder).to.be('/tmp/backups');
|
||||
});
|
||||
|
||||
it('cannot set backup policy with invalid schedule', async function () {
|
||||
const [error] = await safe(backups.setPolicy({ schedule: '', retention: { keepWithinSecs: 1 }}));
|
||||
const [error] = await safe(backupTargets.setPolicy({ schedule: '', retention: { keepWithinSecs: 1 }}));
|
||||
expect(error.reason).to.be(BoxError.BAD_FIELD);
|
||||
});
|
||||
|
||||
it('cannot set backup policy with missing retention', async function () {
|
||||
const [error] = await safe(backups.setPolicy({ schedule: '00 * * * * *'}));
|
||||
const [error] = await safe(backupTargets.setPolicy({ schedule: '00 * * * * *'}));
|
||||
expect(error.reason).to.be(BoxError.BAD_FIELD);
|
||||
});
|
||||
|
||||
it('cannot set backup policy with invalid retention', async function () {
|
||||
const [error] = await safe(backups.setPolicy({ schedule: '00 * * * * *', retention: { keepWhenever: 4 }}));
|
||||
const [error] = await safe(backupTargets.setPolicy({ schedule: '00 * * * * *', retention: { keepWhenever: 4 }}));
|
||||
expect(error.reason).to.be(BoxError.BAD_FIELD);
|
||||
});
|
||||
|
||||
it('can set valid backup policy', async function () {
|
||||
await backups.setPolicy({ schedule: '00 00 2,23 * * 0,1,2', retention: { keepWithinSecs: 1 }});
|
||||
await backupTargets.setPolicy({ schedule: '00 00 2,23 * * 0,1,2', retention: { keepWithinSecs: 1 }});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user