test app clone

This commit is contained in:
Girish Ramakrishnan 2016-10-03 13:38:55 -07:00
parent ef183f0f5f
commit 55b337eefc
2 changed files with 20 additions and 0 deletions

View File

@ -233,6 +233,22 @@ Cloudron.prototype.configureApp = function (appId, newLocation, altDomain /* opt
console.log('App is reachable'.green);
};
Cloudron.prototype.cloneApp = function (appId, newLocation, portBindings) {
portBindings = portBindings || null;
var data = { location: newLocation, password: this._credentials.password, portBindings: portBindings };
var res = request.post(this._origin + '/api/v1/apps/' + appId + '/clone').query({ access_token: this._credentials.accessToken }).send(data).end();
common.verifyResponse2xx(res, 'App could not be clone');
console.log('App cloned to different location'.green);
var app = this.waitForApp(appId);
res = request.get('https://' + app.fqdn).end();
common.verifyResponse2xx(res, 'App is unreachable');
console.log('App is reachable'.green);
};
Cloudron.prototype.uninstallApp = function (appId) {
process.stdout.write('Uninstalling app');
var res = request.post(this._origin + '/api/v1/apps/' + appId + '/uninstall').query({ access_token: this._credentials.accessToken }).send({ password: this._credentials.password }).end();

View File

@ -95,6 +95,10 @@ describe('Appstore new user flow', function () {
cloudron.configureApp(appId, location);
});
it('can clone app', function () {
cloudron.cloneApp(appId, location + 'clone');
});
it('can uninstall app', function () {
cloudron.uninstallApp(appId);
});