|
|
@@ -340,17 +340,19 @@ describe('UserSessionsManager', function () {
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- describe('revokeAllUserSessions', function () {
|
|
|
+ describe('removeSessionsFromRedis', function () {
|
|
|
beforeEach(function () {
|
|
|
this.sessionKeys = ['sess:one', 'sess:two']
|
|
|
- this.retain = []
|
|
|
+ this.currentSessionID = undefined
|
|
|
+ this.stayLoggedIn = false
|
|
|
this.rclient.smembers.callsArgWith(1, null, this.sessionKeys)
|
|
|
this.rclient.del = sinon.stub().callsArgWith(1, null)
|
|
|
this.rclient.srem = sinon.stub().callsArgWith(2, null)
|
|
|
return (this.call = callback => {
|
|
|
- return this.UserSessionsManager.revokeAllUserSessions(
|
|
|
+ return this.UserSessionsManager.removeSessionsFromRedis(
|
|
|
this.user,
|
|
|
- this.retain,
|
|
|
+ { sessionID: this.currentSessionID },
|
|
|
+ { stayLoggedIn: this.stayLoggedIn },
|
|
|
callback
|
|
|
)
|
|
|
})
|
|
|
@@ -387,13 +389,15 @@ describe('UserSessionsManager', function () {
|
|
|
describe('when a session is retained', function () {
|
|
|
beforeEach(function () {
|
|
|
this.sessionKeys = ['sess:one', 'sess:two', 'sess:three', 'sess:four']
|
|
|
- this.retain = ['two']
|
|
|
+ this.currentSessionID = 'two'
|
|
|
+ this.stayLoggedIn = true
|
|
|
this.rclient.smembers.callsArgWith(1, null, this.sessionKeys)
|
|
|
this.rclient.del = sinon.stub().callsArgWith(1, null)
|
|
|
return (this.call = callback => {
|
|
|
- return this.UserSessionsManager.revokeAllUserSessions(
|
|
|
+ return this.UserSessionsManager.removeSessionsFromRedis(
|
|
|
this.user,
|
|
|
- this.retain,
|
|
|
+ { sessionID: this.currentSessionID },
|
|
|
+ { stayLoggedIn: this.stayLoggedIn },
|
|
|
callback
|
|
|
)
|
|
|
})
|
|
|
@@ -457,9 +461,10 @@ describe('UserSessionsManager', function () {
|
|
|
describe('when no user is supplied', function () {
|
|
|
beforeEach(function () {
|
|
|
return (this.call = callback => {
|
|
|
- return this.UserSessionsManager.revokeAllUserSessions(
|
|
|
+ return this.UserSessionsManager.removeSessionsFromRedis(
|
|
|
null,
|
|
|
- this.retain,
|
|
|
+ { sessionID: this.currentSessionID },
|
|
|
+ { stayLoggedIn: this.stayLoggedIn },
|
|
|
callback
|
|
|
)
|
|
|
})
|