cloudron-e2e-test/common.js

28 lines
675 B
JavaScript
Raw Normal View History

2015-06-17 02:13:17 +00:00
'use strict';
2015-06-20 18:49:12 +00:00
var path = require('path');
2015-06-17 02:13:17 +00:00
exports = module.exports = {
TESTAPP_ID: 'io.cloudron.testapp',
2015-06-20 18:47:59 +00:00
TESTAPP_VERSION : '1.0.2',
2015-06-19 20:06:00 +00:00
cloudronDomain: cloudronDomain,
verifyResponse: verifyResponse
2015-06-17 02:13:17 +00:00
};
2015-07-23 20:22:20 +00:00
var gNow = (new Date()).getTime().toString();
2015-06-19 20:06:00 +00:00
function cloudronDomain(filename) {
2015-07-23 20:22:20 +00:00
return 't-' + path.basename(filename, '-test.js') + '-' + gNow + '.smartserver.io';
2015-06-19 20:06:00 +00:00
}
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);
}
}