Make test backwards compatible with app install api change
This commit is contained in:
parent
3dc1878e57
commit
3d3a1807cb
@ -8,6 +8,7 @@ var assert = require('assert'),
|
|||||||
dns = require('dns'),
|
dns = require('dns'),
|
||||||
querystring = require('querystring'),
|
querystring = require('querystring'),
|
||||||
request = require('superagent-sync'),
|
request = require('superagent-sync'),
|
||||||
|
semver = require('semver'),
|
||||||
sleep = require('sleep').sleep,
|
sleep = require('sleep').sleep,
|
||||||
url = require('url');
|
url = require('url');
|
||||||
|
|
||||||
@ -126,10 +127,12 @@ Cloudron.prototype.setCredentials = function (password, accessToken) {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
Cloudron.prototype.installApp = function (location, manifest) {
|
Cloudron.prototype.installApp = function (location, manifest, cloudronVersion) {
|
||||||
|
cloudronVersion = cloudronVersion || '0.0.74';
|
||||||
|
|
||||||
var res = request.post(this._origin + '/api/v1/apps/install')
|
var res = request.post(this._origin + '/api/v1/apps/install')
|
||||||
.query({ access_token: this._credentials.accessToken })
|
.query({ access_token: this._credentials.accessToken })
|
||||||
.send({ manifest: manifest, appStoreId: '', location: location, accessRestriction: null, oauthProxy: false })
|
.send({ manifest: manifest, appStoreId: '', location: location, accessRestriction: semver.lte(cloudronVersion, '0.0.73') ? '' : null, oauthProxy: false })
|
||||||
.end();
|
.end();
|
||||||
common.verifyResponse2(res, 'Cannot install app');
|
common.verifyResponse2(res, 'Cannot install app');
|
||||||
debug('App installed at %s'.green, location);
|
debug('App installed at %s'.green, location);
|
||||||
|
@ -78,7 +78,7 @@ describe('Cloudron update testing', function () {
|
|||||||
var location = 'test' + (Math.random() * 10000).toFixed();
|
var location = 'test' + (Math.random() * 10000).toFixed();
|
||||||
it('can install app', function () {
|
it('can install app', function () {
|
||||||
var manifest = appStore.getManifest(common.TESTAPP_ID, common.TESTAPP_VERSION);
|
var manifest = appStore.getManifest(common.TESTAPP_ID, common.TESTAPP_VERSION);
|
||||||
appId = cloudron.installApp(location, manifest);
|
appId = cloudron.installApp(location, manifest, fromVersion);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('can populate the addons', function () {
|
it('can populate the addons', function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user