cloudron-e2e-test/test/before.js
2016-04-15 21:35:10 -07:00

51 lines
1.3 KiB
JavaScript

/*
* This test cleans up all t-* cloudrons from previous run.
*/
'use strict';
var AppStore = require('../appstore.js'),
common = require('../common.js'),
execSync = require('child_process').execSync;
require('colors');
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
describe('Cleanup old cloudrons', function () {
this.timeout(0);
var appStore = new AppStore('https://api.staging.cloudron.io');
var owner = common.getOwner();
var admin = common.getAdmin();
var cloudrons;
it('can login to the store', function () {
var accessToken = appStore.getAccessToken(owner);
appStore.setCredentials(owner.password, accessToken);
var adminAccessToken = appStore.getAccessToken(admin);
appStore.setAdminCredentials(admin.password, adminAccessToken);
});
it('can list cloudrons', function () {
cloudrons = appStore.getCloudrons();
});
it('admin can delete the cloudrons', function () {
for (var i = 0; i < cloudrons.length; i++) {
appStore.deleteCloudron(cloudrons[i]);
}
});
});
describe('Fake release', function () {
this.timeout(0);
it('can release a fake version to staging', function () {
execSync(__dirname + '/../../release/release rerelease --env staging', { stdio: [ null, process.stdout, process.stderr ] });
});
});