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

Create Mock Http tests for Slack Tokens #524

Merged
merged 7 commits into from
Aug 4, 2021

Conversation

Bpendragon
Copy link
Contributor

  • Converts SlackTokenValidator from using WebClient to HttpClient
  • Adds Mock Http calls to SlackTokenValidatorTests to properly test all code paths.

new
{
Title = "Testing Unknown Slack Error",
HttpStatusCode = HttpStatusCode.OK,
Copy link
Collaborator

@eddynaka eddynaka Aug 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HttpStatusCode.OK

let's add badrequest -> httpcontent = null -> and save as unexpectedstatuscode #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

Slack almost always returns a 200 to any request, even if malformed. This catches if the response is not that.
{
case "token_revoked":
case "account_inactive": { return ValidationState.Expired; }
case "invalid_auth": { return ReturnUnauthorizedAccess(ref message, fingerprint.Secret); }
Copy link
Collaborator

@eddynaka eddynaka Aug 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReturnUnauthorizedAccess

dont do this. use validationState.unauthorized. If you do this, you are going to save the secret in the message. #Closed

Copy link
Collaborator

@eddynaka eddynaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@eddynaka eddynaka enabled auto-merge (squash) August 4, 2021 00:29
@eddynaka eddynaka merged commit 4ca1e08 into main Aug 4, 2021
@eddynaka eddynaka deleted the users/bpendragon/SlackTokenFixes branch August 4, 2021 00:34
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

Successfully merging this pull request may close these issues.

None yet

2 participants