cloudron-e2e-test/test/000-cleanup.js
2015-11-29 17:41:28 +01:00

44 lines
1.0 KiB
JavaScript

#!/usr/bin/env node
/*
* This test cleans up all t-* cloudrons from previous run.
*/
'use strict';
var AppStore = require('../appstore.js'),
common = require('../common.js');
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.setCredentials(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]);
}
});
});