cloudron-e2e-test/common.js
2015-07-27 11:56:16 -07:00

36 lines
938 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 || 'test',
password: process.env.APPSTORE_PASSWORD || 'test1234',
email: process.env.APPSTORE_EMAIL || 'test@cloudron.io'
};
}