backups: add remotePath
the main motivation is that id can be used in REST API routes. previously, the id was a path and this had a "/" in it. This made /api/v1/backups/:backupId not work.
This commit is contained in:
@@ -19,7 +19,8 @@ describe('backups', function () {
|
||||
after(cleanup);
|
||||
|
||||
const boxBackup = {
|
||||
id: 'backup-box',
|
||||
id: null,
|
||||
remotePath: 'backup-box',
|
||||
encryptionVersion: 2,
|
||||
packageVersion: '1.0.0',
|
||||
type: backups.BACKUP_TYPE_BOX,
|
||||
@@ -33,7 +34,8 @@ describe('backups', function () {
|
||||
};
|
||||
|
||||
const appBackup = {
|
||||
id: 'app_appid_123',
|
||||
id: null,
|
||||
remotePath: 'app_appid_123',
|
||||
encryptionVersion: null,
|
||||
packageVersion: '1.0.0',
|
||||
type: backups.BACKUP_TYPE_APP,
|
||||
@@ -47,11 +49,11 @@ describe('backups', function () {
|
||||
};
|
||||
|
||||
it('add succeeds', async function () {
|
||||
await backups.add(boxBackup.id, boxBackup);
|
||||
boxBackup.id = await backups.add(boxBackup);
|
||||
});
|
||||
|
||||
it('fails with duplicating id', async function () {
|
||||
const [error] = await safe(backups.add(boxBackup.id, boxBackup));
|
||||
it('fails with duplicate path', async function () {
|
||||
const [error] = await safe(backups.add(boxBackup));
|
||||
expect(error.reason).to.be(BoxError.ALREADY_EXISTS);
|
||||
});
|
||||
|
||||
@@ -87,7 +89,7 @@ describe('backups', function () {
|
||||
});
|
||||
|
||||
it('add app backup succeeds', async function () {
|
||||
await backups.add(appBackup.id, appBackup);
|
||||
appBackup.id = await backups.add(appBackup);
|
||||
});
|
||||
|
||||
it('get app backup succeeds', async function () {
|
||||
|
||||
Reference in New Issue
Block a user