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

Refactoring & testing utils/authentication.py #234

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

corey-nm
Copy link
Contributor

This is PR is a refactor of the sparsezoo/utils/authentication.py module, as discussed in a previous PR. It also adds unit tests for all the functionality.

Summary:

  • Replaced SparseZooCredentials class with two functions:
    • _maybe_load_token which tries to read in token from a path
    • _save_token which saves a token to a path
  • The logic for loading a token is much more linear now, instead of spread across multiple methods

@@ -124,24 +55,63 @@ def get_auth_header(

Currently only 'public' authentication type is supported.

:param authentication_type: authentication type for generating token
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed authentication_type as a parameter since there was only 1 valid type and nowhere uses the parameter. Seem okay?

rahul-tuli
rahul-tuli previously approved these changes Aug 27, 2022
Copy link
Contributor

@KSGulin KSGulin left a comment

Choose a reason for hiding this comment

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

One nit + it looks like a quality check failed, but otherwise LGTM 🙂

src/sparsezoo/utils/authentication.py Show resolved Hide resolved
@corey-nm corey-nm requested review from KSGulin and rahul-tuli and removed request for kylesayrs September 9, 2022 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants