Skip to content

Instantly share code, notes, and snippets.

@vladikoff
Created February 25, 2014 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vladikoff/ee583aca7dbf4a863ba5 to your computer and use it in GitHub Desktop.
Save vladikoff/ee583aca7dbf4a863ba5 to your computer and use it in GitHub Desktop.
Waiting for email...
{ code: 401,
  errno: 110,
  error: 'Unauthorized',
  message: 'Invalid authentication token in request signature',
  info: 'https://github.com/mozilla/fxa-auth-server/blob/master/docs/api.md#response-format',
  log: 
   [ { op: 'server.onRequest', rid: '1393349834041-53303-39366' },
     { op: 'DB.getToken',
       id: 'e27ab22dff6a76bff8581314a7e9afb7af4ec5d01e6757aea33600c8d8bb536c',
       rid: '1393349834041-53303-39366' },
     { op: 'Heap.sessionToken',
       id: 'e27ab22dff6a76bff8581314a7e9afb7af4ec5d01e6757aea33600c8d8bb536c',
       rid: '1393349834041-53303-39366' } ] }
FAIL: main - account - #reset password (42ms)
// sign up
return respond(client.signUp(email, password), RequestMocks.signUp)
.then(function (result) {
uid = result.uid;
assert.ok(uid, "uid is returned");
sessionToken = result.sessionToken;
// start password forgot
return respond(client.passwordForgotSendCode(email), RequestMocks.passwordForgotSendCode);
})
.then(function (result) {
passwordForgotToken = result.passwordForgotToken;
assert.ok(passwordForgotToken, "passwordForgotToken is returned");
// wait for reset email
return respond(mail.wait(user, 2), RequestMocks.resetMail);
})
.then(function (emails) {
var code = emails[1].html.match(/code=([A-Za-z0-9]+)/)[1];
assert.ok(code, "code is returned: " + code);
// confirm code
return respond(client.passwordForgotVerifyCode(code, passwordForgotToken), RequestMocks.passwordForgotVerifyCode);
})
.then(function (result) {
accountResetToken = result.accountResetToken;
var newPassword = 'newturles';
assert.ok(accountResetToken, "accountResetToken is returned");
// account reset
return respond(client.accountReset(email, newPassword, accountResetToken), RequestMocks.accountReset);
})
.then(function() {
// try to get devices for the logged in session
return respond(client.accountDevices(sessionToken), RequestMocks.accountDevices)
})
.then(
function(res) {
assert.property(res, 'devices');
},
function(err) {
// errors
console.log(err);
assert.fail();
}
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment