The role parameter is set to NotSet by default
but the assertion only allowed str and unicode.
So it would always fail. Add NotSet to the assertion
to allow calling the function without a role.
Signed-off-by: Pascal Bach <pascal.bach@nextrem.ch>
The path requested in Repository.get_contents() is appended to the URL,
so the root path should be requested with the empty string. If path is
'/', set it to the empty string. Copy the replay data from the original
test, since it is identical.
Drive-by renaming the test to include the missing 's'.
Closes#1059
# Problem #
The `.whl` available on PyPi for this repository contains its entire `tests` submodule.
The total size of the `pygithub` module is less than `1mb` without tests and `>23mb` with.
Previous discussions on this topic indicated the removal of tests would be accepted if someone created a pull request to do so: https://github.com/PyGithub/PyGithub/issues/672
This is that pull request! 😄
# Solution/Implementation #
- Moved "tests" to root of the repository ( outside the package )
- Added `tests.` module path to the imports in `AllTests.py`
- Updated `setup.py`
- Removed `package_data` from product
- Removed "tests" from packages definition
- Repointed `test_suite` to new location
- Updated `travis.yml`
- Added conditional ( if not `py2.7` ) conversion of code to `py3`
_... apologies for all the failed build spam below - new to working with Travis CI / had some gotcha moments!_
This is a continuation of the work started by @allevin on https://github.com/PyGithub/PyGithub/pull/860.
I have refactored the testing Framework to use the `httpretty` library in order to use the urllib3 retry feature and therefore be able to test it.
Please refer to https://github.com/PyGithub/PyGithub/pull/860 for additional context.
cc: @allevin @mfonville @jrouquie @sfdye
Closes#757Closes#860
PullRequest.get_review_comments() works with no arguments passed due to
if short circuiting, but as soon as you pass since, you get an exception
since datetime wasn't imported. Import it, and add a test case for good
measure.
Closes#1004
#664 got rid of most of httplib and replaced it with requests.
This is the last place it was used. It makes a more coherent code base I think.
Tests are ok locally.
Added support for the traffic endpoints found at https://developer.github.com/v3/repos/traffic/.
We added four functions to the Repository class (one for each of the endpoints) with corresponding unit tests.
Fixes#926
When there is no link header sent, this signifies that this is the only
page of results. If data is empty, or only contains a list of items, we
should count them, but this can be defeated -- if the returned data
contains a total_count key, we should use it. This also uncovered a bug
in the test suite for searching topics.
Closes#960
The return value of MainClass.search_topics() was a paginated list of
Repository, which is incorrect. Add a Topic class to encapuslate what is
returned.
Fixes#929
This PR proposes adding two missing params to constructor in `.reversed`. This preserves the `headers` as well as the `list_item` once cloned.
Fixes#945.
I found when authorized, the ratelimit error message is different from unauthorized.
so i add this.
After studying hard with my 2b colleagues @AnYeMoWang , we finally realized how tests wrote.
😸😸😸😸😸😸😸
Wraps the parts of the branch protection API that allows the user to require signed commits on a branch.
New methods are :
* Branch.get_required_signatures : returns true if signed commits are required
* Branch.add_required_signatures : adds the requirements for signed commits on a branch
* Branch.remove_required_signatures : removes the requirement for signed commits on a branch
It uses the API provided on this page : https://developer.github.com/v3/repos/branches/
Since this feature is in [preview](https://developer.github.com/changes/2018-02-22-protected-branches-required-signatures/) I pass the 'Accept application/vnd.github.zzzax-preview+json' header to each request.
## Changes
- Add `affiliation` parameter to `get_collaborators()` and use it to filter collaborators through the API
- Resolves#937
PS: Would have loved to add a simple test for this but there seems to be a problem on my end using OAuth as I'm just not able to authenticate to the API during tests.
Wraps the parts of the notification API that allows the user to mark notifications as read.
New methods are :
- Notification.mark_as_read : marks a single notification thread as read
- Repository.mark_notifications_as_read : marks all the notifications for a given repository as read
- AuthenticatedUser.mark_notifications_as_read : marks all the notifications as read
Aims to fix : https://github.com/PyGithub/PyGithub/issues/571 and simply uses the APIs described on this page : https://developer.github.com/enterprise/11.10.340/v3/activity/notifications/
A weird thing I noticed doing this is that Repository.notifications_url doesn't seem to be usable directly. I used Repository.url + "/notifications" instead.
* Add a trailing slash to URL when updating or deleting a file.
* Update test files to match new create/update/delete_file Repo methods
* Add trailing slash to get_contents() method
* update tests
* add missing slash in get_dir_contents
* add example usage
* remove dup slashes in tests
* clarify example comments
This commit add the title of milestone in string representation of Milestone class.
This modification improve readbility of milestone instances.
Before:
```python
>>> repo.get_milestone(number=1)
Milestone(number=1)
```
After:
```python
>>> repo.get_milestone(number=1)
Milestone(title='Milestone Example', number=1)
```
Requester.__requestRaw() was handling 301 redirects by passing the full
URL to itself, when it only expects a URL path, so parse out the path,
and pass that in. Add a test for this behaviour.
Closes: #906
The Github gists api has a since parameter for the various gist searches. This adds that parameter to Github.get_gists(), NamedUser.get_gists() and Authenticator.get_gists(). Tests and replay data added/updated as needed.
I added a Time module in the tests directory, containing just a UTCtzinfo class, which I felt I needed for one of the tests (and would probably be useful in other since/until tests). Might not be the best name for the module but it seemed the least invasive thing to do.