Commit 7f75f29e authored by Robert Knight's avatar Robert Knight Committed by GitHub

Merge pull request #218 from hypothesis/add-test-for-failed-grant-token-request

Add test for failed grant token request
parents 0e8e035f 4087de35
...@@ -53,6 +53,18 @@ describe('oauth auth', function () { ...@@ -53,6 +53,18 @@ describe('oauth auth', function () {
}); });
}); });
it('should raise if an access token request fails', function () {
fakeHttp.post.returns(Promise.resolve({status: 500}));
return auth.tokenGetter().then(
function onResolved () {
assert(false, 'The Promise should have been rejected');
},
function onRejected (error) {
assert.equal(error.message, 'Failed to retrieve access token');
}
);
});
it('should cache tokens for future use', function () { it('should cache tokens for future use', function () {
return auth.tokenGetter().then(function () { return auth.tokenGetter().then(function () {
fakeHttp.post.reset(); fakeHttp.post.reset();
......
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