cloudron-e2e-test/common.js
2015-07-23 14:18:51 -07:00

36 lines
892 B
JavaScript

'use strict';
var path = require('path');
exports = module.exports = {
TESTAPP_ID: 'io.cloudron.testapp',
TESTAPP_VERSION : '1.0.2',
cloudronDomain: cloudronDomain,
verifyResponse: verifyResponse,
getOwner: getOwner,
};
var gNow = ((new Date()).getTime() / 1000).toFixed();
function cloudronDomain(filename) {
return 't-' + path.basename(filename, '-test.js') + '-' + gNow + '.smartserver.io';
}
function verifyResponse(res, errorMessage) {
if (res.statusCode < 200 || res.statusCode > 299) {
console.log('Response error statusCode:%s error:%s body:%s', res.statusCode, res.error, res.body);
console.log(errorMessage.red);
process.exit(1);
}
}
function getOwner() {
return {
username: process.env.APPSTORE_USERNAME,
password: process.env.APPSTORE_PASSWORD,
email: process.env.APPSTORE_EMAIL
};
}