Commit 23991e2f authored by Robert Knight's avatar Robert Knight

Add a test for handling of unsuccessful auth code exchange

parent 96b397ec
......@@ -528,6 +528,24 @@ describe('sidebar.oauth-auth', function () {
assert.equal(err.message, 'Authorization window was closed');
});
});
it('rejects if auth code exchange fails', () => {
var loggedIn = auth.login();
// Successful response from authz popup.
fakeWindow.sendMessage({
type: 'authorization_response',
code: 'acode',
state: 'notrandom',
});
// Error response from auth code => token exchange.
fakeHttp.post.returns(Promise.resolve({status: 400}));
return loggedIn.catch(err => {
assert.equal(err.message, 'Authorization code exchange failed');
});
});
});
// Advance time forward so that any current access tokens will have expired.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment