create backup before clone

This commit is contained in:
Girish Ramakrishnan 2016-10-03 14:30:47 -07:00
parent 13292e5aba
commit 4a11b3432b
3 changed files with 17 additions and 0 deletions

View File

@ -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');

View File

@ -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';

View File

@ -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');
});