fix(server): do not return flowId from consumeSigninCodes endpoint

https://github.com/mozilla/fxa-auth-server/pull/1952
r=vbudhram
This commit is contained in:
Phil Booth 2017-06-22 14:07:05 +01:00 коммит произвёл GitHub
Родитель 307f24c639
Коммит 6fd020dc7e
2 изменённых файлов: 12 добавлений и 4 удалений

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

@ -56,7 +56,7 @@ module.exports = (log, db, customs) => {
return request.emitMetricsEvent(`flow.continued.${result.flowId}`) return request.emitMetricsEvent(`flow.continued.${result.flowId}`)
} }
}) })
.then(() => result) .then(() => ({ email: result.email }))
}) })
} }
} }

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

@ -10,10 +10,14 @@ const mocks = require('../../mocks')
const P = require('../../../lib/promise') const P = require('../../../lib/promise')
describe('/signinCodes/consume:', () => { describe('/signinCodes/consume:', () => {
let log, db, customs, routes, route, request let log, db, customs, routes, route, request, response
describe('success, db does not return flowId:', () => { describe('success, db does not return flowId:', () => {
beforeEach(() => setup({ db: { email: 'foo@bar' } })) beforeEach(() => setup({ db: { email: 'foo@bar' } }).then(r => response = r))
it('returned the correct response', () => {
assert.deepEqual(response, { email: 'foo@bar' })
})
it('called log.begin correctly', () => { it('called log.begin correctly', () => {
assert.equal(log.begin.callCount, 1) assert.equal(log.begin.callCount, 1)
@ -56,7 +60,11 @@ describe('/signinCodes/consume:', () => {
}) })
describe('success, db returns flowId:', () => { describe('success, db returns flowId:', () => {
beforeEach(() => setup({ db: { email: 'foo@bar', flowId: 'baz' } })) beforeEach(() => setup({ db: { email: 'foo@bar', flowId: 'baz' } }).then(r => response = r))
it('returned the correct response', () => {
assert.deepEqual(response, { email: 'foo@bar' })
})
it('called log.begin once', () => { it('called log.begin once', () => {
assert.equal(log.begin.callCount, 1) assert.equal(log.begin.callCount, 1)