|
@@ -45,7 +45,8 @@ describe('ClsiCookieManager', function () {
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
clsiCookie: {
|
|
clsiCookie: {
|
|
|
- ttl: Math.random(),
|
|
|
|
|
|
|
+ ttlInSeconds: Math.random().toString(),
|
|
|
|
|
+ ttlInSecondsRegular: Math.random().toString(),
|
|
|
key: 'coooookie',
|
|
key: 'coooookie',
|
|
|
},
|
|
},
|
|
|
}
|
|
}
|
|
@@ -172,7 +173,7 @@ describe('ClsiCookieManager', function () {
|
|
|
this.redis.setex
|
|
this.redis.setex
|
|
|
.calledWith(
|
|
.calledWith(
|
|
|
`clsiserver:${this.project_id}:${this.user_id}`,
|
|
`clsiserver:${this.project_id}:${this.user_id}`,
|
|
|
- this.settings.clsiCookie.ttl,
|
|
|
|
|
|
|
+ this.settings.clsiCookie.ttlInSeconds,
|
|
|
'clsi-8'
|
|
'clsi-8'
|
|
|
)
|
|
)
|
|
|
.should.equal(true)
|
|
.should.equal(true)
|
|
@@ -181,6 +182,27 @@ describe('ClsiCookieManager', function () {
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+ it('should set the server id with the regular ttl for reg instance', function (done) {
|
|
|
|
|
+ this.ClsiCookieManager._parseServerIdFromResponse = sinon
|
|
|
|
|
+ .stub()
|
|
|
|
|
+ .returns('clsi-reg-8')
|
|
|
|
|
+ this.ClsiCookieManager.setServerId(
|
|
|
|
|
+ this.project_id,
|
|
|
|
|
+ this.user_id,
|
|
|
|
|
+ 'standard',
|
|
|
|
|
+ this.response,
|
|
|
|
|
+ null,
|
|
|
|
|
+ err => {
|
|
|
|
|
+ expect(this.redis.setex).to.have.been.calledWith(
|
|
|
|
|
+ `clsiserver:${this.project_id}:${this.user_id}`,
|
|
|
|
|
+ this.settings.clsiCookie.ttlInSecondsRegular,
|
|
|
|
|
+ 'clsi-reg-8'
|
|
|
|
|
+ )
|
|
|
|
|
+ done()
|
|
|
|
|
+ }
|
|
|
|
|
+ )
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
it('should return the server id', function (done) {
|
|
it('should return the server id', function (done) {
|
|
|
return this.ClsiCookieManager.setServerId(
|
|
return this.ClsiCookieManager.setServerId(
|
|
|
this.project_id,
|
|
this.project_id,
|
|
@@ -260,7 +282,7 @@ describe('ClsiCookieManager', function () {
|
|
|
this.redis_secondary.setex
|
|
this.redis_secondary.setex
|
|
|
.calledWith(
|
|
.calledWith(
|
|
|
`clsiserver:${this.project_id}:${this.user_id}`,
|
|
`clsiserver:${this.project_id}:${this.user_id}`,
|
|
|
- this.settings.clsiCookie.ttl,
|
|
|
|
|
|
|
+ this.settings.clsiCookie.ttlInSeconds,
|
|
|
'clsi-8'
|
|
'clsi-8'
|
|
|
)
|
|
)
|
|
|
.should.equal(true)
|
|
.should.equal(true)
|