Initial commit of asset queuing (#97)

* Initial commit of asset queuing

* Addresssing comments
This commit is contained in:
Wyatt Johnson
2016-11-28 13:29:39 -05:00
committed by Dan Zajdband
parent c1a7b95705
commit b0f01cf00f
38 changed files with 832 additions and 408 deletions
-31
View File
@@ -1,31 +0,0 @@
const mongoose = require('../../mongoose');
// Ensure the NODE_ENV is set to 'test',
// this is helpful when you would like to change behavior when testing.
process.env.NODE_ENV = 'test';
beforeEach(function (done) {
function clearDB() {
for (let i in mongoose.connection.collections) {
mongoose.connection.collections[i].remove(function() {});
}
return done();
}
if (mongoose.connection.readyState === 0) {
mongoose.on('open', function() {
if (err) {
throw err;
}
return clearDB();
});
} else {
return clearDB();
}
});
after(function (done) {
mongoose.disconnect();
return done();
});
-25
View File
@@ -1,25 +0,0 @@
const authorization = require('../../middleware/authorization');
// Add the passport middleware here before it's setup.
authorization.middleware.push((req, res, next) => {
req.user = JSON.parse(new Buffer(req.get('X-Mock-Authorization'), 'base64').toString('ascii'));
next();
});
const MockStrategy = {
/**
* Injects the new user into the request header for the mock middleware to
* interpret.
* @param {Object} user the user to inject
* @return {Object} the headers to add to the request
*/
inject(user) {
return {
'X-Mock-Authorization': new Buffer(JSON.stringify(user)).toString('base64')
};
}
};
module.exports = MockStrategy;