From 4a11b3432bb73158b98687cec83deded11ff1894 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Mon, 3 Oct 2016 14:30:47 -0700 Subject: [PATCH] create backup before clone --- cloudron.js | 7 +++++++ test/app-flow-test.js | 5 +++++ test/new-user-test.js | 5 +++++ 3 files changed, 17 insertions(+) diff --git a/cloudron.js b/cloudron.js index e1de428..081ef7a 100644 --- a/cloudron.js +++ b/cloudron.js @@ -399,6 +399,13 @@ Cloudron.prototype.resetPassword = function (resetToken, password) { assert.strictEqual(res.statusCode, 302); }; +Cloudron.prototype.backupApp = function (appId) { + var res = request.post(this._origin + '/api/v1/apps/' + appId + '/backup').query({ access_token: this._credentials.accessToken }).end(); + common.verifyResponse2xx(res, 'Could not schedule backup'); + + this.waitForApp(appId); +}; + Cloudron.prototype.backup = function () { var res = request.get(this._origin + '/api/v1/backups').query({ access_token: this._credentials.accessToken }).end(); common.verifyResponse2xx(res, 'Could not get backups'); diff --git a/test/app-flow-test.js b/test/app-flow-test.js index adcaf41..284e88d 100644 --- a/test/app-flow-test.js +++ b/test/app-flow-test.js @@ -120,6 +120,11 @@ describe('Application flow test', function () { checkExposedPort(5151, done); }); + // clone requires a backup to work with + it('can backup app', function () { + cloudron.backupApp(appId); + }); + var cloneLocation; it('can clone app', function () { cloneLocation = location + 'clone'; diff --git a/test/new-user-test.js b/test/new-user-test.js index b5ed5e0..8d4aa9f 100644 --- a/test/new-user-test.js +++ b/test/new-user-test.js @@ -95,6 +95,11 @@ describe('Appstore new user flow', function () { cloudron.configureApp(appId, location); }); + // clone requires a backup to work with + it('can backup app', function () { + cloudron.backupApp(appId); + }); + it('can clone app', function () { cloudron.cloneApp(appId, location + 'clone'); });