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

fix: correctly separate multiple scopes with '&' #177

Merged
merged 1 commit into from
Sep 25, 2020

Conversation

edwardgeorge
Copy link
Contributor

was generating invalid query strings with multiple scopes, eg:

.authenticate(&["repository:foo:pull", "repository:bar:pull"])

is serialised as:

?service=...&scope=repository:foo:pullscope=repository:bar:pull

note the missing '&' between pull and scope.

@lucab
Copy link
Member

lucab commented Sep 22, 2020

@edwardgeorge good catch! If you don't mind, can you please add unit tests for the following three cases:

  • no scopes
  • one scope
  • more than one scope

@edwardgeorge
Copy link
Contributor Author

@lucab sure, no problem.

@edwardgeorge
Copy link
Contributor Author

@lucab updated with three tests

Copy link
Contributor

@steveej steveej left a comment

Choose a reason for hiding this comment

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

Thank you @edwardgeorge for the tests and the bugfix!
The PR looks good to me. I'll leave it up to you if you want to use https://crates.io/crates/test-case to conflate these similar cases into a single test function declaration.
If you choose to do so, note that test-case doesn't support Result return types, i.e. it'll silently ignore errors and state that the test has passed. Which means you'd have to use unwrap instead of ?.
If you choose not to do so, let me know and I'll happily merge it 🙂

was generating invalid query strings, eg:

```
?service=...&scope=repository:foo:pullscope=repository:bar:pull
```

note the missing '&' between pull and scope.

tests: added tests for multiple scope serialisation
@edwardgeorge
Copy link
Contributor Author

@steveej updated with consolidated, parametrized tests

@steveej steveej merged commit becb174 into camallo:master Sep 25, 2020
@edwardgeorge edwardgeorge deleted the fix-multiple-scopes branch September 25, 2020 15:51
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

3 participants