fix(test): increase totp code window (#2548), r=@vladikoff

This commit is contained in:
Vijay Budhram 2018-07-31 09:30:36 -04:00 коммит произвёл GitHub
Родитель 2a2eeabab9
Коммит fecc9e3044
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 5 добавлений и 6 удалений

Просмотреть файл

@ -23,7 +23,7 @@ describe('remote recovery codes', function () {
otplib.authenticator.options = {
encoding: 'hex',
step: config.step
window: 10
}
before(() => {

Просмотреть файл

@ -24,8 +24,7 @@ describe('remote totp', function () {
otplib.authenticator.options = {
crypto: crypto,
encoding: 'hex',
step: 1,
window: 4
window: 10
}
before(() => {
@ -249,8 +248,8 @@ describe('remote totp', function () {
it('should verify totp code from previous code window', () => {
const futureAuthenticator = new otplib.Authenticator()
futureAuthenticator.options = Object.assign({}, authenticator.options, {epoch: -10000})
const code = authenticator.generate()
futureAuthenticator.options = Object.assign({}, authenticator.options, {epoch: Date.now() / 1000 - 30})
const code = futureAuthenticator.generate()
return client.verifyTotpCode(code, {metricsContext, service: 'sync'})
.then((response) => {
assert.equal(response.success, true, 'totp codes match')
@ -263,7 +262,7 @@ describe('remote totp', function () {
it('should not verify totp code from future code window', () => {
const futureAuthenticator = new otplib.Authenticator()
futureAuthenticator.options = Object.assign({}, authenticator.options, {epoch: 10000})
futureAuthenticator.options = Object.assign({}, authenticator.options, {epoch: Date.now() / 1000 + 3000})
const code = futureAuthenticator.generate()
return client.verifyTotpCode(code, {metricsContext, service: 'sync'})
.then((response) => {