Skip to content

Add unit testcase for RefreshAndStoreToken function #423

@Kshitij-Katiyar

Description

@Kshitij-Katiyar
          @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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions