cloudron-e2e-test/common.js

36 lines
938 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 {
2015-07-27 18:56:16 +00:00
username: process.env.APPSTORE_USERNAME || 'test',
password: process.env.APPSTORE_PASSWORD || 'test1234',
email: process.env.APPSTORE_EMAIL || 'test@cloudron.io'
2015-07-23 20:46:47 +00:00
};
}
2015-06-19 20:06:00 +00:00