cloudron-e2e-test/common.js

36 lines
892 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,
2015-07-23 20:46:47 +00:00
verifyResponse: verifyResponse,
getOwner: getOwner,
2015-06-17 02:13:17 +00:00
};
var gNow = ((new Date()).getTime() / 1000).toFixed();
2015-07-23 20:22:20 +00:00
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);
}
}
2015-07-23 20:46:47 +00:00
function getOwner() {
return {
username: process.env.APPSTORE_USERNAME,
password: process.env.APPSTORE_PASSWORD,
email: process.env.APPSTORE_EMAIL
};
}
2015-06-19 20:06:00 +00:00