Ensure auth code expiration is calculated at the right time

This commit is contained in:
Johannes Zellner
2016-04-13 11:32:30 +02:00
parent d83395ecfb
commit 259798a8f2

View File

@@ -32,18 +32,22 @@ describe('janitor', function () {
accessToken: tokendb.generateToken(),
identifier: tokendb.PREFIX_USER + '0',
clientId: 'clientid-0',
expires: Date.now() + 60 * 60000,
expires: Date.now(),
scope: '*'
};
var TOKEN_1 = {
accessToken: tokendb.generateToken(),
identifier: tokendb.PREFIX_USER + '1',
clientId: 'clientid-1',
expires: Date.now() - 1000,
expires: Date.now(),
scope: '*',
};
before(function (done) {
// Only now calculate the expiration, otherwise it happens when the test code gets loaded, not when this is executed
TOKEN_0.expires = Date.now() + 60 * 60 * 1000;
TOKEN_1.expires = Date.now() - 1000;
async.series([
database.initialize,
database._clear,