The parameters 'all' and 'participating' for AuthenticatedUser.get_notifications() should
be lower case strings, not textual forms of a boolean.
Fixes: #1671
Requester.__log() sanitizes the headers of the request so that
authentication details are not logged, but this has the side effect of
meaning that future requests that use the same Requester object will
fail. Usually, this is perfectly fine, since almost every method will
only make one request -- where this falls down is when we make another
after a redirect. Make a copy of the requestHeaders, and sanitize those.
Fixes#1959
OrderedDict needs to be typed just like Dict needs to be typed. The
OrderedDict "input" variable key and value are used to append to a
string without any processing, so it seems unlikely that something other
than a string would be valid.
The tests path is not part of the shipped project, thus this type cannot
be checked by users of this project.
The correct type in place of the type imported from tests appears to be
Optional[
Union[HTTPRequestsConnectionClass, HTTPSRequestsConnectionClass]
]
As a property these functions are expected to be accessed without the
private __get_ and __set_ functions, however while the functions are
typed, the property is not, and mypy shows an attribute error.
As this codebase no-longer requires support for python versions without
support for @property.setter(2.6?) this updates the functions to use
decorators and updates the type files to reflect the attribute
existence.
Now that GitHub have moved their documentation from
developer.github.com, we should update our links. I have also tried to
update the call strings to their new format, but since it was done via
regex, some of them may not match exactly.
* Adding attributes "maintain" and "triage" to class "github.Permissions.Permissions"
* Fix for failed test due to extended attribute list
* Adding new simplistic test case for class Permissions
Fixes#1809
Since GitHub has the bad manners to return bare strings for some API
endpoints, one sharp edge has been that JSON decoding errors were masked
since we wrap the string in a dictionary. However, this makes it
difficult to debug malformed JSON in replay data, so re-raise the
exception if the first character is a { or [ (IE, it's an object or
list.)
Both CheckSuite and Commit have a get_check_runs() method that allows
filtering by a string -- the original code did not check for it, and
never added it to the query string since it checked the wrong variable.
Check the right variable and re-record the replay data.
Fixes#1843
The assertions in github.Project.edit looked like the result of a bad
copy-paste operation: they were all making assertions about the `name`
parameter. This commit fixes them so they are checking different parameters.
Authenticating via client_id and client_secret is dangerous, since they
appended to the query string, and can be easily seen from the URL.
client_id/client_secret have been deprecated since May 2020, and ignored
by GitHub since late 2020, so it's high time they were removed.
Since the headers that led to an exception are also useful, firstly pass
them into the constructor, and then export them in a property. Test one
specific use case to make sure of coverage.
Fixes#1814
When a previous commit added support for creating secrets on repository
objects, support was not added to also remove them. Since the GitHub API
does support that, add a method to do so.
requests has a default connections pool of 10. Creating multiple threads
will consume from that same pool, since the underlying implementation of
the requests pool is a singletown.
Let's make the pool_size configurable, so clients can set the proper
number for their use case when running multiple threads.
Signed-off-by: Amador Pahim <apahim@redhat.com>
* Add initial support for Check Suites
* Add API call detail in CheckSuite.rerequest
* Update Accept header with general instead of preview
* Add 'get check runs' endpoint for CheckSuite with stubs
* Add create check suite endpoint with stub
* Update CheckSuite tests with creat check suite endpoint
* Add update check suites preferences endpoint
* Add repository preferences object and stub file
* Add update check suite preferences tests
Needed for #1621
Co-authored-by: Raju Subramanian <coder@mahesh.net>
* Add missing preview features of Deployment and Deployment Statuses API
- Enable support for deployment status states in_progress and queued
- Add arguments production_environment and transient_environment to Repository.create_deployment()
- Add attributes production_environment and transient_environment to Deployment
- Use correct type in assertion for Deployment.payload
- Fix incorrect assertion for description in Deployment.create_status()
- Add arguments environment, environment_url, auto_inactive to Deployment.create_status()
- Add attribute environment_url to DeploymentStatus
* Add CheckRun object and stub file
* Add list of check runs endpoint for Commit
* Add get check run endpoint for Repository
* Add CheckRun test file and replay data files
* Add CheckRunAnnotation object and stub file
* Add create CheckRun API endpoint to Repository
* Update and add new tests for CheckRun endpoint:
There are two get_installation() methods in MainClass, with different
arguments. get_installation(owner, repo) is documented and tested, and
get_installation(id) is neither. Remove it to avoid confusion.
Black is very opinionated, but sometimes those opinions change. Run the
new black version across the codebase, and lock down the version used by
pre-commit so we don't get surprised like this again.