fixed travis settings
This commit is contained in:
parent
b2b09171f3
commit
8ea1f63c96
@ -14,4 +14,4 @@ addons:
|
||||
script:
|
||||
- npm travis
|
||||
after_script:
|
||||
- grunt coverage
|
||||
- grunt coveralls
|
||||
|
||||
@ -191,11 +191,6 @@ exports.update = function(req, res) {
|
||||
delete updatedForm.admin;
|
||||
}
|
||||
|
||||
if(form.analytics === null){
|
||||
form.analytics.visitors = [];
|
||||
form.analytics.gaCode = '';
|
||||
}
|
||||
|
||||
//Do this so we can create duplicate fields
|
||||
var checkForValidId = new RegExp('^[0-9a-fA-F]{24}$');
|
||||
for(var i=0; i < req.body.form.form_fields.length; i++){
|
||||
|
||||
@ -113,7 +113,7 @@ describe('User CRUD tests', function() {
|
||||
var UserObj = new User(_User);
|
||||
UserObj.save(function(err){
|
||||
done(err);
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
it('should be able to reset password of a created User with a valid passwordResetToken', function(done) {
|
||||
@ -230,8 +230,8 @@ describe('User CRUD tests', function() {
|
||||
var UserObj = new User(_User);
|
||||
UserObj.save(function(err, user){
|
||||
done(err);
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
it('should be able to change password when logged in', function(done) {
|
||||
var changedPassword = 'aVeryBadPassword';
|
||||
@ -350,7 +350,7 @@ describe('User CRUD tests', function() {
|
||||
.end(function(err, res) {
|
||||
User.remove().exec(done);
|
||||
});
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
describe(' > User API > ', function(){
|
||||
@ -361,8 +361,8 @@ describe('User CRUD tests', function() {
|
||||
var UserObj = new User(_User);
|
||||
UserObj.save(function(err, user){
|
||||
done(err);
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
it('should be able to request API Key', function(done) {
|
||||
async.waterfall([
|
||||
@ -396,8 +396,8 @@ describe('User CRUD tests', function() {
|
||||
userSession.get('/users/me?apikey=' + apiKey)
|
||||
.expect(200)
|
||||
.end(function(err, res) {
|
||||
console.log(res.body);
|
||||
var user = res.body;
|
||||
|
||||
user.firstName.should.equal(_User.firstName);
|
||||
user.lastName.should.equal(_User.lastName);
|
||||
user.email.should.equal(_User.email);
|
||||
@ -442,9 +442,9 @@ describe('User CRUD tests', function() {
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function(done){
|
||||
after(function(done){
|
||||
User.remove().exec(done);
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
after(function(done) {
|
||||
|
||||
@ -75,7 +75,7 @@ logger.getLogOptions = function getLogOptions() {
|
||||
var _config = _.clone(config, true);
|
||||
var configFileLogger = _config.log.fileLogger;
|
||||
|
||||
if (!_.has(_config, 'log.fileLogger.directoryPath') || !_.has(_config, 'log.fileLogger.fileName')) {
|
||||
if (process.env.NODE_ENV !== 'test' && !_.has(_config, 'log.fileLogger.directoryPath') || !_.has(_config, 'log.fileLogger.fileName')) {
|
||||
console.log('unable to find logging file configuration');
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -9,12 +9,21 @@ module.exports.isAuthenticatedOrApiKey = function isAuthenticated(req, res, next
|
||||
|
||||
// Try authenticate with API KEY
|
||||
if (req.headers.apikey || req.query.apikey || req.body.apikey) {
|
||||
passport.authenticate('localapikey', function (err, user, info) {
|
||||
if (err)
|
||||
return res.sendStatus(500);
|
||||
if(!req.body.apikey && req.headers.apikey){
|
||||
req.body.apikey = req.headers.apikey;
|
||||
} else if(!req.query.apikey && req.headers.apikey){
|
||||
req.query.apikey = req.headers.apikey;
|
||||
}
|
||||
|
||||
if (!user)
|
||||
passport.authenticate('localapikey', function (err, user, info) {
|
||||
if (err) {
|
||||
return res.status(500).send('Internal Server Error with API. Sorry about that!');
|
||||
}
|
||||
|
||||
if (!user) {
|
||||
console.log('no user for apikey');
|
||||
return res.status(401).send(info.message || '');
|
||||
}
|
||||
|
||||
req.login(user, function(loginErr) {
|
||||
if (loginErr) return res.sendStatus(500);
|
||||
|
||||
@ -11,13 +11,15 @@ module.exports = function() {
|
||||
return User.findOne({
|
||||
'apiKey': apiKey
|
||||
}, function(err, user) {
|
||||
if (err)
|
||||
if (err) {
|
||||
return done(err);
|
||||
}
|
||||
|
||||
if (!user)
|
||||
if (!user){
|
||||
return done(null, false, {
|
||||
message: 'Unknown API Key'
|
||||
});
|
||||
}
|
||||
|
||||
return done(null, user);
|
||||
});
|
||||
|
||||
@ -211,7 +211,7 @@ module.exports = function(grunt) {
|
||||
coverageFolder: 'coverageServer',
|
||||
mask: '*.test.js',
|
||||
require: ['server.js'],
|
||||
reportFormats: ['cobertura','lcovonly']
|
||||
reportFormats: ['html','lcovonly']
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -219,7 +219,7 @@ module.exports = function(grunt) {
|
||||
options: {
|
||||
emitters: ['event'],
|
||||
},
|
||||
src: ['./coverageServer/*.info', './clientCoverage/lcov-report/*.info']
|
||||
src: ['./coverageServerg/*.info', './clientCoverage/lcov-report/*.info']
|
||||
},
|
||||
html2js: {
|
||||
options: {
|
||||
@ -283,7 +283,7 @@ module.exports = function(grunt) {
|
||||
});
|
||||
|
||||
// Code coverage tasks.
|
||||
grunt.registerTask('coveralls', ['env:test','lcovMerge']);
|
||||
grunt.registerTask('coveralls', ['test:client', 'karma:unit', 'mocha_istanbul:coverageServer', 'lcovMerge']);
|
||||
grunt.registerTask('coverage:server', ['env:test', 'mocha_istanbul:coverageServer']);
|
||||
|
||||
// Default task(s).
|
||||
@ -310,7 +310,7 @@ module.exports = function(grunt) {
|
||||
grunt.registerTask('test', ['test:server', 'test:client']);
|
||||
grunt.registerTask('test:server', ['lint:tests', 'env:test', 'mochaTest']);
|
||||
grunt.registerTask('test:client', ['lint:tests', 'html2js:main', 'html2js:forms', 'env:test', 'karma:unit']);
|
||||
grunt.registerTask('test:travis', ['env:test', 'html2js:main', 'html2js:forms', 'env:test', 'karma:unit', 'mochaTest', 'coveralls']);
|
||||
grunt.registerTask('test:travis', ['env:test', 'html2js:main', 'html2js:forms', 'env:test', 'karma:unit', 'mochaTest']);
|
||||
|
||||
|
||||
grunt.registerTask('testdebug', ['env:test', 'karma:debug']);
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
"generate": "all-contributors generate",
|
||||
"start": "grunt",
|
||||
"test": "grunt test",
|
||||
"travis": "grunt test:travis",
|
||||
"travis": "grunt travis",
|
||||
"postinstall": "bower install --config.interactive=false; grunt build;",
|
||||
"init": "node scripts/setup.js"
|
||||
},
|
||||
|
||||
@ -62,9 +62,6 @@ console.log('--');
|
||||
console.log(chalk.green('Environment:\t\t\t' + process.env.NODE_ENV));
|
||||
console.log(chalk.green('Port:\t\t\t\t' + config.port));
|
||||
console.log(chalk.green('Database:\t\t\t' + config.db.uri));
|
||||
if (process.env.NODE_ENV === 'secure') {
|
||||
console.log(chalk.green('HTTPs:\t\t\t\ton'));
|
||||
}
|
||||
console.log('--');
|
||||
|
||||
process.on('uncaughtException', function (err) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user