2015-07-27 23:17:37 +00:00
|
|
|
#!/usr/bin/env node
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This test cleans up all t-* cloudrons from previous run.
|
|
|
|
*/
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var AppStore = require('../appstore.js'),
|
2015-11-19 18:37:53 +00:00
|
|
|
common = require('../common.js');
|
2015-07-27 23:17:37 +00:00
|
|
|
|
|
|
|
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();
|
2015-11-29 16:41:28 +00:00
|
|
|
var admin = common.getAdmin();
|
2015-07-27 23:17:37 +00:00
|
|
|
var cloudrons;
|
|
|
|
|
|
|
|
it('can login to the store', function () {
|
|
|
|
var accessToken = appStore.getAccessToken(owner);
|
|
|
|
appStore.setCredentials(owner.password, accessToken);
|
2015-11-29 16:41:28 +00:00
|
|
|
|
|
|
|
var adminAccessToken = appStore.getAccessToken(admin);
|
|
|
|
appStore.setCredentials(admin.password, adminAccessToken);
|
2015-07-27 23:17:37 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('can list cloudrons', function () {
|
|
|
|
cloudrons = appStore.getCloudrons();
|
|
|
|
});
|
|
|
|
|
2015-11-29 16:41:28 +00:00
|
|
|
it('admin can delete the cloudrons', function () {
|
2015-07-27 23:17:37 +00:00
|
|
|
for (var i = 0; i < cloudrons.length; i++) {
|
|
|
|
appStore.deleteCloudron(cloudrons[i]);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|