Commit Graph
1128 Commits
Author SHA1 Message Date
Glenn McDonald 9564cd4de7 Add repo edit support for delete_branch_on_merge (#1381)
* Add repo edit support for delete_branch_on_merge

* Assert delete_branch_on_merge
2020-02-11 12:24:33 +11:00
Steve Kowalik 784deb5f68 Run black over the entire tree (#1386)
It's been a while since black was run over the entire tree, and since CI
still doesn't check it, we can get behind.
2020-02-11 10:37:25 +11:00
Tim Gates ad040bafaf Fix mistake in Repository.create_fork() (#1383)
I modified #1306 to use the NotSet parameter after
it was pointed out this was more appropriate however
I did not also update the conditional.
2020-02-09 20:38:50 +11:00
Steve Kowalik 882fe0871a Correct two attributes in Invitation (#1382)
Proving once again that untested code is broken code, correctly set two
attributes during initialization of Invitation. Increase coverage by
checking every attribute.
2020-02-09 17:45:51 +11:00
Huw Jones 4ae1a1e523 Search repo issues by string label (#1379)
* Allow use of strings for labels in Repository.get_issues

* Fix unittests

* Update docstring

* Removed brackets from "list of..."
2020-02-09 16:41:33 +11:00
Steve Kowalik ead565adf8 Correct Repository.create_git_tag_and_release() (#1362)
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
2020-01-25 16:34:48 +11:00
Steve Kowalik 37122cf2bb Switch to no argument super() (#1361)
Now that Python 2 support is gone, we can switch to no argument super()
rather than calling our superclass by name.
2020-01-21 21:15:22 +11:00
Geoff Low 06a300aee0 exposed seats and filled_seats for Github Organization Plan (#1360)
Expose two new attributes for Organization Plans
2020-01-21 10:27:19 +11:00
Steve Kowalik 0e09983dca Repository.create_project() body is optional (#1359)
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
2020-01-19 14:31:58 +10:00
Steve Kowalik b11add4193 Implement move action for ProjectCard (#1356)
ProjectCard's have the ability to be moved between columns, implement
the GitHub API to do so.

Fixes #1312
2020-01-19 14:30:19 +10:00
Steve Kowalik dd80a6c091 Tidy up ProjectCard.get_content() (#1355)
ProjectCard.get_content() did not document its one argument or assert
its type. Do so, as well as generally tidy up the calls.
2020-01-17 13:44:18 +10:00
Gilad Shefer eacabb2fb9 Added nested teams and parent (#1348)
* 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
2020-01-12 10:17:54 +10:00
Steve Kowalik 16e5f9891f Correct parameter for Label.edit (#1350)
The existing code for Label.edit was passing 'name' as a parameter to
the PATCH call, but GitHub expects 'new_name', correct it.
2020-01-12 10:16:39 +10:00
Steve Kowalik fc4eff3185 Fix all but one sphinx warnings (#1346)
To hopefully correct our doc build, tidy up some of the warnings that
sphinx complains about. The one remaining one is legitimate.
2020-01-11 10:15:34 +10:00
Steve Kowalik b7894ea00c Drop Python 2 support (#1329)
With the Python 2 deadline gone, it's time to move with the times and
switch to Python 3 only.
2020-01-06 18:01:38 +11:00
Steve Kowalik d938f80be0 Run black and isort to prepare for release (#1328)
Run black and isort over github/*py and tests/*py to prepare for a new
release.
2019-12-29 11:53:00 +11:00
Steve Kowalik 60464f6554 Allow sha=None for InputGitTreeElement (#1327)
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
2019-12-29 10:50:23 +11:00
Nick Campbell 732fd26abd Support github timeline events. (#1302)
Adds support for retrieval of Github timeline events.

Signed-off-by: Nick Campbell <nicholas.j.campbell@gmail.com>
2019-12-29 10:50:05 +11:00
Steve Kowalik 88e30057a7 Remove API preview parameter (#1325)
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.
2019-12-29 10:49:45 +11:00
Tim Gates baddb7193f Add support for update branch (#1317)
* 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
2019-12-12 20:50:25 +08:00
Steve Kowalik b0ef1909f9 Refactor Logging tests (#1315)
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.
2019-12-11 16:02:14 +11:00
Wan Liuyang 540a085001 Fix isort - add known first and third party 2019-12-11 00:54:59 +08:00
Wan Liuyang 88549a56df black 2019-12-10 23:13:34 +08:00
Wan Liuyang 6ceb9e9a15 Apply black to whole codebase (#1303) 2019-12-10 17:14:33 +08:00
Kevin LaFlamme f8e33620f4 Fix class used returning pull request comments (#1307)
Repository.get_pull_request_comments() was returning the wrong type.
2019-11-30 12:14:50 +11:00
Tim Gates 2ad51f352e Support for create_fork (#1306)
* 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
2019-11-28 21:44:00 +11:00
Steve Kowalik 989b635e33 Allow GithubObject.update() to be passed headers (#1300)
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
2019-11-26 14:29:24 +11:00
Steve Kowalik 3170cafce5 Correct URL for assignees on PRs (#1296)
The URL that was used for POST/DELETE when adding and removing
assignees was the PR itself, when it should be the issue_url.

Fixes #1294
2019-11-25 20:44:13 +11:00
Steve KowalikandJonas Maurus 3e3d8c54ab Fix Branch's push restriction API (#1290)
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>
2019-11-22 20:49:58 +11:00
Steve Kowalik 21e89ff1f8 Deprecate Repository.get_dir_contents() (#1285)
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
2019-11-14 22:17:34 +11:00
Adam Baratz ac68274200 Expand Topic class and add test coverage (#1252)
* Expand Topic class and add test coverage

* Add test coverage for Topic properties

* Fix misspelling in comment
2019-11-04 15:06:52 +11:00
Adam Baratz ec3c8d7b3b Add support for team discussions (#1246) (#1249)
* Add support for team discussions (#1246)

* Make a TeamDiscussion completeable
2019-10-31 21:19:10 +11:00
Steve Kowalik 077c80ba2d Correct API for NamedUser.get_organization_membership (#1277)
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
2019-10-31 20:56:46 +11:00
Steve Kowalik 6ad592b1b6 Correct header check for 2FA required (#1274)
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
2019-10-25 21:01:58 +11:00
Pavan Kunisetty a163ba1562 Add assignee removal/addition support to PRs (#1241)
Add assignee removal/addition support to PRs
Fixes #1109

Add test for new PR assignee functionality

Add record file

Addressed comments on #1016
2019-10-22 21:34:55 +11:00
Steve Kowalik bc225f9d11 Encode content for {create,update}_file (#1267)
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
2019-10-22 21:30:34 +11:00
Adam Baratz a076508370 Stop ignoring unused imports and remove them (#1250)
* Stop ignoring unused imports and remove them

* Stop ignoring * imports
2019-10-19 16:43:14 +11:00
Pavan Kunisetty e50420f771 Implemented user organization membership. Added test case. (#1237)
1. Added AuthenticatedUser:get_organization_membership
2. Added NamedUser:get_organization_membership
3. Added related tests as GitMembership and related replay data
2019-10-03 22:33:06 +10:00
Steve Kowalik e33858a3dc Support non-default URLs in GithubIntegration (#1229)
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.
2019-09-25 23:01:31 +10:00
Steve Kowalik 89c967bb77 Cleanup try/except import in PaginatedList (#1228)
Since we're using six.moves to import parse_qs, we don't need to check
for an import exception, we can just import it directly.
2019-09-25 15:22:06 +10:00
Steve Kowalik f91cbac2e3 Add an IncompletableObject exception (#1227)
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.
2019-09-23 16:40:06 +10:00
Jake Klingensmith 850da5af27 Fix redundant int checks (#1226) 2019-09-23 16:28:07 +10:00
Olof-Joachim Frahm (欧雅福) 020fbebcaf Jump from notifications to related PRs/issues. (#1168)
* 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.
2019-09-22 18:59:21 +10:00
Olof-Joachim Frahm (欧雅福) b84d9b1928 Code review bodies are optional in some cases. (#1169)
* Code review bodies are optional in some cases.

* Add test for approving PRs without body set.
2019-09-20 11:00:07 +10:00
Steve Kowalik a0f01cf9cf Remove more Python version specific code (#1193)
Remove a bunch of other call sites that behaved differently between
Python 2 and 3, massively cleaning up a few messy methods.
2019-08-28 15:24:54 +10:00
Olof-Joachim Frahm (欧雅福) e90cdab06d Fix PR review creation. (#1184)
Do not modify the attributes of a PR when creating a review.
2019-08-09 19:12:55 +10:00
Will Li 8abd50e225 Add support to vulnerability alert and automated security fixes APIs (#1195)
* 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
2019-08-08 12:24:33 +10:00
Steve Kowalik 7ddb657d47 Delete Legacy submodule (#1192)
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.
2019-08-06 15:16:07 +10:00
Steve Kowalik cca8e3a5b4 Remove some uses of atLeastPython3 (#1191)
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.
2019-08-05 16:14:39 +10:00
Steve Kowalik f93207b4ca Run flake8 in Travis (#1163)
Clean up a few errors I missed, ignore another, and configure flake8 using
a config file to ignore certain errors. The next step would be to remove
the F* ignores.
2019-08-05 15:03:10 +10:00