Skip to content
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

Add unit testcase for RefreshAndStoreToken function #423

Open
Kshitij-Katiyar opened this issue Oct 28, 2024 · 0 comments
Open

Add unit testcase for RefreshAndStoreToken function #423

Kshitij-Katiyar opened this issue Oct 28, 2024 · 0 comments

Comments

@Kshitij-Katiyar
Copy link
Contributor

          @Kshitij-Katiyar This is where much of the functionality was added in this PR. I'm thinking we can test this function and `CheckUserConnected` directly. What do you think?

We basically want to emulate this in a test since this is the code that is applied throughout the PR:

	if !c.tokenHelpers.CheckUserConnected(c.mattermostUserID) {
		c.Logger.Warnf(LogUserInactive, c.mattermostUserID)
		return nil, errors.New(ErrorUserInactive)
	}
	err := someCallToAPI // this can be whatever we want in the test
	if err != nil {
		c.tokenHelpers.DisconnectUserFromStoreIfNecessary(err, c.mattermostUserID)

We can use a "real" KV store in the test with one of the following strategies:

Originally posted by @mickmister in #256 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant