-
Notifications
You must be signed in to change notification settings - Fork 604
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed failing unit test - invalidate call revoke endpoint twice. Unit test did not validate it correctly. #2349
Conversation
Isn't this working correctly on |
It is failing on master also. Revoke endpoint is called twice and it fails on the first request and succeeds on the second. It is not caught by mocha, because it is not correctly implemented. I can prove it by debugging. |
expect(revokeRequests.find(body => body.token_type_hint === 'access_token')).to.eql({ | ||
'token_type_hint': 'access_token', | ||
'token': 'access token!' | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the messages of the describe
and test
this is in, I would assume there's a dedicated test for asserting the access token is invalidated?
expect(revokeRequests.find(body => body.token_type_hint === 'refresh_token')).to.eql({ | ||
'token_type_hint': 'refresh_token', | ||
'token': 'refresh token!' | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume it would be simpler to just wrap the expect
in line 340 in an if body.token_type_hint === 'refresh_token'
.
Sorry, I think that's what you had originally but I didn't fully understand the issue before…
a253371
to
e464740
Compare
Issue
The unit test was testing the authenticator.invalidate method. It is calling revoke endpoint twice. One time revoke refresh_token and the second time revoke access_token. Unit test expected only one request for refresh_token. Call for revoke access_token was not expected and was failing quietly.
Fix
When the fake revoke endpoint is called, only the refresh token is validated.