Skip to content

Add Secret and Variable classes#2623

Merged
EnricoMi merged 43 commits intoPyGithub:mainfrom
premisedata:main
Aug 10, 2023
Merged

Add Secret and Variable classes#2623
EnricoMi merged 43 commits intoPyGithub:mainfrom
premisedata:main

Conversation

@nthings
Copy link
Copy Markdown
Contributor

@nthings nthings commented Jul 13, 2023

Hi! this PR is for adding the Secret and Variable classes. Before I added the variable methods to Organization and Repository but I think is better handling this way. Let me know feedback if this is good so I can start adding test cases. Ty!

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jul 25, 2023

Codecov Report

❌ Patch coverage is 82.06278% with 40 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.48%. Comparing base (7cfa476) to head (40fc3f2).
⚠️ Report is 380 commits behind head on main.

Files with missing lines Patch % Lines
github/OrganizationSecret.py 74.50% 13 Missing ⚠️
github/OrganizationVariable.py 74.50% 13 Missing ⚠️
github/Repository.py 66.66% 5 Missing ⚠️
github/Variable.py 90.00% 5 Missing ⚠️
github/Secret.py 89.18% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2623      +/-   ##
==========================================
- Coverage   97.72%   97.48%   -0.24%     
==========================================
  Files         132      136       +4     
  Lines       13568    13745     +177     
==========================================
+ Hits        13259    13399     +140     
- Misses        309      346      +37     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@trim21
Copy link
Copy Markdown
Contributor

trim21 commented Jul 25, 2023

Please see 8bdfc3a for some examples how to inline typing into the .py file.

@nthings
Copy link
Copy Markdown
Contributor Author

nthings commented Jul 25, 2023

Addressed most of comments can I get a re-review? @EnricoMi @trim21 Also bit of help needed into the implementation of PaginatedList on the selected_repositories property

@trim21
Copy link
Copy Markdown
Contributor

trim21 commented Jul 25, 2023

Sorry, I mean to move _initAttributes, and make it the first method of class, don't move __repr__

@nthings
Copy link
Copy Markdown
Contributor Author

nthings commented Jul 25, 2023

Sorry, I mean to move _initAttributes, and make it the first method of class, don't move __repr__

Ok. Below the properties right?

@trim21
Copy link
Copy Markdown
Contributor

trim21 commented Jul 25, 2023

Sorry, I mean to move _initAttributes, and make it the first method of class, don't move __repr__

Ok. Below the properties right?

class ...:

_initAttributes

__repr__

others

_useAttributes

@nthings
Copy link
Copy Markdown
Contributor Author

nthings commented Jul 26, 2023

@trim21 reordered those methods. Do you have example of a class that one of the properties is a PaginatedList?

@trim21
Copy link
Copy Markdown
Contributor

trim21 commented Jul 26, 2023

@trim21 reordered those methods. Do you have example of a class that one of the properties is a PaginatedList?

def get_licenses(self):
"""
:calls: `GET /licenses <https://docs.github.com/en/rest/reference/licenses#get-all-commonly-used-licenses>`_
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.License.License`
"""
url_parameters = dict()
return github.PaginatedList.PaginatedList(github.License.License, self.__requester, "/licenses", url_parameters)

@nthings
Copy link
Copy Markdown
Contributor Author

nthings commented Jul 27, 2023

@trim21 I think I got it working. Please let me know any feedback so I can go ahead with test cases

@nthings nthings requested a review from trim21 July 31, 2023 14:51
Copy link
Copy Markdown
Collaborator

@EnricoMi EnricoMi left a comment

Choose a reason for hiding this comment

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

LGTM!

Ideally, we would have tests for get_secret, get_secrets, create_secrets, get_variable, get_variables and create_variables on Organization and Repository, assert all attributes of Secret, OrganizationSecret and Variable (at least in one test), and call selected_repositories on OrganizationSecret and OrganizationVariable.

Mauricio Alejandro Martínez Pacheco added 2 commits August 9, 2023 11:28
@nthings
Copy link
Copy Markdown
Contributor Author

nthings commented Aug 10, 2023

@EnricoMi @trim21 Test cases added!

Copy link
Copy Markdown
Collaborator

@EnricoMi EnricoMi left a comment

Choose a reason for hiding this comment

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

LGTM!

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.

4 participants