Skip to content

Conversation

@wehrler
Copy link
Contributor

@wehrler wehrler commented Feb 26, 2024

Set username based on token

Description

The username field is currently set when a client is instantiated. Due to different auth workflows, the username may not match the preferred username defined in the auth token. This PR attempts to adjust the username based on the auth token.

Checklist

Please complete the following checklist before submitting your pull request:

  • I have tested these changes locally and verified that they work as intended.
  • I have updated any documentation as needed to reflect these changes (if appropriate)
  • I have verified that these changes to the best of my knowledge do not introduce any security vulnerabilities.
  • Unit tests have been added (if appropriate)
  • Test-cases have been added (if appropriate)
  • Testing instructions have been added (if appropriate)

Set username based on token
@github-actions github-actions bot added dependencies Related with project dependencies maintenance Package and maintenance related labels Feb 26, 2024
@codecov
Copy link

codecov bot commented Feb 26, 2024

Codecov Report

Attention: Patch coverage is 83.33333% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 92.82%. Comparing base (dd4cfce) to head (71d1112).

Files Patch % Lines
src/ansys/hps/client/client.py 83.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #348      +/-   ##
==========================================
- Coverage   92.87%   92.82%   -0.06%     
==========================================
  Files          61       61              
  Lines        2247     2258      +11     
==========================================
+ Hits         2087     2096       +9     
- Misses        160      162       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Raise exception when username passed does not match preferred_username
@wehrler wehrler requested review from PipKat and nezgrath February 27, 2024 15:14
Copy link
Member

@PipKat PipKat left a comment

Choose a reason for hiding this comment

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

LGTM but I can only reviewing docstring content. I can't judge if the code is acceptable.

Copy link
Contributor

@FedericoNegri FedericoNegri left a comment

Choose a reason for hiding this comment

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

Please also add a test in test_client.py.

Copy link
Contributor

@FedericoNegri FedericoNegri left a comment

Choose a reason for hiding this comment

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

Looks good, thanks

@FedericoNegri FedericoNegri added the enhancement New features or code improvements label Feb 28, 2024
@wehrler wehrler merged commit ba6616e into main Feb 28, 2024
@wehrler wehrler deleted the wehrler/fix_scaler_registration_username branch February 28, 2024 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Related with project dependencies enhancement New features or code improvements maintenance Package and maintenance related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants