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

Client id parameter #4

Merged
merged 7 commits into from
Jan 17, 2025
Merged

Client id parameter #4

merged 7 commits into from
Jan 17, 2025

Conversation

mpatrou
Copy link
Collaborator

@mpatrou mpatrou commented Jan 16, 2025

Short description of the changes:

Client id parameter as an optional parameter added for ONCatLogin.

Long description of the changes:

In detail it includes:

  • client id in ONCatLogin
  • related tests updates and new additions
  • documentation update on usage
  • github actions updated due to failure --> the same change happened in another PR

Check list for the pull request

  • I have read the [CONTRIBUTING]
  • I have read the [CODE_OF_CONDUCT]
  • I have added tests for my changes
  • I have updated the documentation accordingly

Check list for the reviewer

  • I have read the [CONTRIBUTING]
  • I have verified the proposed changes
  • best software practices
    • all internal functions have an underbar, as is python standard
    • clearly named variables (better to be verbose in variable names)
    • code comments explaining the intent of code blocks
  • All the tests are passing
  • The documentation is up to date
  • code comments added when explaining intent

Manual test for the reviewer

References

ClientId parameter able to be passed from the client application

@codecov-commenter
Copy link

codecov-commenter commented Jan 16, 2025

Codecov Report

Attention: Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 93.75%. Comparing base (04fb9a4) to head (d1c5851).
Report is 11 commits behind head on next.

Files with missing lines Patch % Lines
src/pyoncatqt/login.py 90.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             next       #4      +/-   ##
==========================================
+ Coverage   93.52%   93.75%   +0.22%     
==========================================
  Files           3        3              
  Lines         139      144       +5     
==========================================
+ Hits          130      135       +5     
  Misses          9        9              

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

@mpatrou mpatrou marked this pull request as draft January 16, 2025 20:08
Copy link
Member

@peterfpeterson peterfpeterson left a comment

Choose a reason for hiding this comment

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

Small change requested for getting the client id. I appreciate the extra tests.

Note: This has the changes of #5 and #7 already in it.

@@ -215,11 +221,15 @@ def __init__(self: QGroupBox, key: str = None, parent: QWidget = None, **kwargs:
# OnCat agent

self.oncat_url = get_data("login.oncat", "oncat_url")
self.client_id = get_data("login.oncat", f"{key}_id")
self.client_id = client_id or get_data("login.oncat", f"{key}_id")
Copy link
Member

Choose a reason for hiding this comment

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

Small problem here. If neither is defined then the second half is get_data("login.oncat", "None_id") which gives the right behavior but seems a little dodgy. It may be better to expand this out.

Suggested change
self.client_id = client_id or get_data("login.oncat", f"{key}_id")
if (client_id is not None):
self.client_id = client_id
else if (key is not None):
self.client_id = get_data("login.oncat", f"{key}_id")
else:
raise ValueError(f"Invalid module {key}. No OnCat client Id is found or provided for this application.")

I've not seen this syntax before. Thanks for the pointer.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it is another way to write the above in fewer lines. I'll update the code, if it creates issues. I added it, because it looked cleaner to me.

@mpatrou mpatrou marked this pull request as ready for review January 17, 2025 13:54
Copy link
Member

@peterfpeterson peterfpeterson 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

@peterfpeterson peterfpeterson merged commit 554fb9b into next Jan 17, 2025
4 checks passed
@peterfpeterson peterfpeterson deleted the client_id branch January 17, 2025 15:40
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.

3 participants