Proving once again that untested code is broken code, correctly set two
attributes during initialization of Invitation. Increase coverage by
checking every attribute.
Repository.create_git_tag_and_release() is a convience function that
creates a git tag and then a release. It was not passing the SHA1 of the
commit to the release function, resulting in incorrect releases.
Fixes#1336
The POST parameters passed to the create_project API call did not
consider the body optional, and always included it. Fix up a formatting
error in the docstring for good measure.
Fixes#1357
* Added nested teams and parent
- Added github.Team.Team.get_teams() to get nested teams.
- Added github.Team.Team.parent which points to the parent team.
Fixes#1337
InputGitTreeElement is used to build tree objects for
Repository.create_git_tree(). However, the GitHub API allows passing
sha=null to delete a file, which we don't allow. Extend the checking in
InputGitTreeElement to also allow None, and add a test for good measure.
Fixes#1318
The API preview flag for both MainClass and Requester was the last
hard-coded custom header, and it seems to not be relevant since
mid-2015. Remove it, if any users are using it, they shouldn't be. Its
code path was also entirely untested.
* Add Support for PullRequest update-branch
* Add test case
* Fix test case
* Add test data record
* Update PullRequest.py
* Update PullRequest.py
* Support py2.7
* Assert response status is 202
* black + isort
To stop skipping logging tests on Python 3, refactor them to mock out
the logger and check arguments directly, rather than naively comparing
strings. Allow a logger to be injected into Requester for this.
* Support for create_fork
http://developer.github.com/v3/repos/forks
* Add test case for create_fork
* Add param doc and fix extra line
* Specify the organization to increase line coverage
* Update test data
* Add type assert for organization param
SourceImport.update() is really GithubObject.update(), which just calls
GET on the object's URL. Refetching a source import requires an
additional header, so change GithubObject.update() to pass any it is
given, and add a test for SourceImport.update()
Fixes#1297
The current API for changing user and teams push restrictions is
brittle, and flat out incorrect when it comes to adding members. Break
the API, but replace it with one that is correct.
Co-Authored-By: Jonas Maurus <jonas-github@maurus.net>
Repository.get_contents() and Repository.get_dir_contents() call the
same endpoint, with slightly different error handling, and with the
difference that get_dir_contents() throws an odd exception if you call
it with a file. get_contents() already even handles being called for a
directory anyway, so deprecate get_dir_contents(), and refactor the code
so the tests pass.
Fixes#1283
NamedUser.get_organization_membership() was calling the API method for
fetching the currently authenticated user only, which is incorrect. The
method was not tested directly, so add tests. Furthermore, Membership
had some errors which had slipped through review, so correct them.
Sadly, this is an API break, since passing the organization as an int
made no sense in this case.
Fixes#1276
Currently, we were checking for an uppercase header if GitHub was
refusing our authentication because we didn't provide a token. Requests
returns headers with all lowercase. Fix the const, and add a test for
good measure.
Fixes#1273
If a byte object (for Python 3) was passed into either create_file or
update_file, it was attempted to be co-erced into a bytearray, which
failed. Check for encoded content before we encode it into bytes and
then base64 encode it.
Fixes#1266
1. Added AuthenticatedUser:get_organization_membership
2. Added NamedUser:get_organization_membership
3. Added related tests as GitMembership and related replay data
The get_installation() method of GithubIntegration was hardcoded to
always use the default URL of api.github.com, making it impossible to
fetch the installation of an GitHub Enterprise installation.
If a returned object from GitHub does not include an URL, that object
can not be completed, and used to fail with an obscure traceback saying
NoneType has no method startswith. Check for this, and raise
IncompletableObject instead.
* Jump from notifications to related PRs/issues.
* Add test case for jumping to related PRs/issues.
Also another method to get notifications scoped to a repository,
otherwise it's hard to keep out sensitive information from the test
cases.
* Add functions about automated security fixes and vulnerability alerts
* Refine methods and add unit test
* Add record
* Update record file - change user name
* Add get vulnerability alert function
* Fix typo
* Create file for testCreateFile
* Add tests
* Add unit test
* Simplify assert statement
Since the only part of the Legacy submodule that is used and tested is
the transform issue function, refactor it into a Repository method and
delete it.
There are a number of call sites that would behave differently depending
on Python 2 or 3. A fair amount of them are left over from Python 3.2 or
Python 2.6 were the current versions, and it was much harder to write
compatible code for both versions. Happily, that is now in the past, so
refactor some of them out.