forked from transifex/PyGithub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added missing params to constructor when reversed (PyGithub#946)
This PR proposes adding two missing params to constructor in `.reversed`. This preserves the `headers` as well as the `list_item` once cloned. Fixes PyGithub#945.
- Loading branch information
Showing
5 changed files
with
99 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -122,3 +122,4 @@ | |
from Issue494 import * | ||
from Issue572 import * | ||
from Issue937 import * | ||
from Issue945 import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
############################ Copyrights and license ############################ | ||
# # | ||
# Copyright 2018 Kelvin Wong (https://github.com/netsgnut) # | ||
# # | ||
# This file is part of PyGithub. # | ||
# http://pygithub.readthedocs.io/ # | ||
# # | ||
# PyGithub is free software: you can redistribute it and/or modify it under # | ||
# the terms of the GNU Lesser General Public License as published by the Free # | ||
# Software Foundation, either version 3 of the License, or (at your option) # | ||
# any later version. # | ||
# # | ||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY # | ||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # | ||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # | ||
# details. # | ||
# # | ||
# You should have received a copy of the GNU Lesser General Public License # | ||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. # | ||
# # | ||
################################################################################ | ||
|
||
import Framework | ||
|
||
import github | ||
|
||
|
||
class Issue945(Framework.TestCase): # https://github.com/PyGithub/PyGithub/issues/945 | ||
def setUp(self): | ||
Framework.TestCase.setUp(self) | ||
self.repo = self.g.get_user("openframeworks").get_repo("openFrameworks") | ||
self.list = self.repo.get_issues() | ||
self.list_with_headers = self.repo.get_stargazers_with_dates() | ||
|
||
def testReservedPaginatedListAttributePreservation(self): | ||
r1 = self.list.reversed | ||
self.assertEqual(self.list._PaginatedList__contentClass, r1._PaginatedList__contentClass) | ||
self.assertEqual(self.list._PaginatedList__requester, r1._PaginatedList__requester) | ||
self.assertEqual(self.list._PaginatedList__firstUrl, r1._PaginatedList__firstUrl) | ||
self.assertEqual(self.list._PaginatedList__firstParams, r1._PaginatedList__firstParams) | ||
self.assertEqual(self.list._PaginatedList__headers, r1._PaginatedList__headers) | ||
self.assertEqual(self.list._PaginatedList__list_item, r1._PaginatedList__list_item) | ||
|
||
self.assertTrue(self.list_with_headers._PaginatedList__headers is not None) | ||
r2 = self.list_with_headers.reversed | ||
self.assertEqual(self.list_with_headers._PaginatedList__contentClass, r2._PaginatedList__contentClass) | ||
self.assertEqual(self.list_with_headers._PaginatedList__requester, r2._PaginatedList__requester) | ||
self.assertEqual(self.list_with_headers._PaginatedList__firstUrl, r2._PaginatedList__firstUrl) | ||
self.assertEqual(self.list_with_headers._PaginatedList__firstParams, r2._PaginatedList__firstParams) | ||
self.assertEqual(self.list_with_headers._PaginatedList__headers, r2._PaginatedList__headers) | ||
self.assertEqual(self.list_with_headers._PaginatedList__list_item, r2._PaginatedList__list_item) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
https | ||
GET | ||
api.github.com | ||
None | ||
/users/openframeworks | ||
{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} | ||
None | ||
200 | ||
[('Server', 'GitHub.com'), ('Date', 'Fri, 26 Oct 2018 06:02:39 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Status', '200 OK'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4973'), ('X-RateLimit-Reset', '1540536267'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP'), ('ETag', 'W/"490a721bce7bb5817a38a53711404075"'), ('Last-Modified', 'Wed, 18 Nov 2015 16:33:25 GMT'), ('X-OAuth-Scopes', 'repo'), ('X-Accepted-OAuth-Scopes', ''), ('X-GitHub-Media-Type', 'github.v3; format=json'), ('Access-Control-Expose-Headers', 'ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('Access-Control-Allow-Origin', '*'), ('Strict-Transport-Security', 'max-age=31536000; includeSubdomains; preload'), ('X-Frame-Options', 'deny'), ('X-Content-Type-Options', 'nosniff'), ('X-XSS-Protection', '1; mode=block'), ('Referrer-Policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('Content-Security-Policy', "default-src 'none'"), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'ED32:235D:2CFA30:625A06:5BD2ADFE')] | ||
{"login":"openframeworks","id":142866,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0Mjg2Ng==","avatar_url":"https://avatars2.githubusercontent.com/u/142866?v=4","gravatar_id":"","url":"https://api.github.com/users/openframeworks","html_url":"https://github.com/openframeworks","followers_url":"https://api.github.com/users/openframeworks/followers","following_url":"https://api.github.com/users/openframeworks/following{/other_user}","gists_url":"https://api.github.com/users/openframeworks/gists{/gist_id}","starred_url":"https://api.github.com/users/openframeworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openframeworks/subscriptions","organizations_url":"https://api.github.com/users/openframeworks/orgs","repos_url":"https://api.github.com/users/openframeworks/repos","events_url":"https://api.github.com/users/openframeworks/events{/privacy}","received_events_url":"https://api.github.com/users/openframeworks/received_events","type":"Organization","site_admin":false,"name":"openFrameworks","company":null,"blog":"http://openframeworks.cc/","location":null,"email":null,"hireable":null,"bio":null,"public_repos":9,"public_gists":0,"followers":0,"following":0,"created_at":"2009-10-21T21:54:37Z","updated_at":"2015-11-18T16:33:25Z"} | ||
|
||
https | ||
GET | ||
api.github.com | ||
None | ||
/repos/openframeworks/openFrameworks | ||
{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} | ||
None | ||
200 | ||
[('Server', 'GitHub.com'), ('Date', 'Fri, 26 Oct 2018 06:02:40 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Status', '200 OK'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4972'), ('X-RateLimit-Reset', '1540536267'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP'), ('ETag', 'W/"501068d9a3e67fb624ce5e83e1270d41"'), ('Last-Modified', 'Fri, 26 Oct 2018 04:18:01 GMT'), ('X-OAuth-Scopes', 'repo'), ('X-Accepted-OAuth-Scopes', 'repo'), ('X-GitHub-Media-Type', 'github.v3; format=json'), ('Access-Control-Expose-Headers', 'ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('Access-Control-Allow-Origin', '*'), ('Strict-Transport-Security', 'max-age=31536000; includeSubdomains; preload'), ('X-Frame-Options', 'deny'), ('X-Content-Type-Options', 'nosniff'), ('X-XSS-Protection', '1; mode=block'), ('Referrer-Policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('Content-Security-Policy', "default-src 'none'"), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'ACCA:235E:3C0006:7729D5:5BD2ADFF')] | ||
{"id":345337,"node_id":"MDEwOlJlcG9zaXRvcnkzNDUzMzc=","name":"openFrameworks","full_name":"openframeworks/openFrameworks","private":false,"owner":{"login":"openframeworks","id":142866,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0Mjg2Ng==","avatar_url":"https://avatars2.githubusercontent.com/u/142866?v=4","gravatar_id":"","url":"https://api.github.com/users/openframeworks","html_url":"https://github.com/openframeworks","followers_url":"https://api.github.com/users/openframeworks/followers","following_url":"https://api.github.com/users/openframeworks/following{/other_user}","gists_url":"https://api.github.com/users/openframeworks/gists{/gist_id}","starred_url":"https://api.github.com/users/openframeworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openframeworks/subscriptions","organizations_url":"https://api.github.com/users/openframeworks/orgs","repos_url":"https://api.github.com/users/openframeworks/repos","events_url":"https://api.github.com/users/openframeworks/events{/privacy}","received_events_url":"https://api.github.com/users/openframeworks/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/openframeworks/openFrameworks","description":"openFrameworks is a community-developed cross platform toolkit for creative coding in C++.","fork":false,"url":"https://api.github.com/repos/openframeworks/openFrameworks","forks_url":"https://api.github.com/repos/openframeworks/openFrameworks/forks","keys_url":"https://api.github.com/repos/openframeworks/openFrameworks/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openframeworks/openFrameworks/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openframeworks/openFrameworks/teams","hooks_url":"https://api.github.com/repos/openframeworks/openFrameworks/hooks","issue_events_url":"https://api.github.com/repos/openframeworks/openFrameworks/issues/events{/number}","events_url":"https://api.github.com/repos/openframeworks/openFrameworks/events","assignees_url":"https://api.github.com/repos/openframeworks/openFrameworks/assignees{/user}","branches_url":"https://api.github.com/repos/openframeworks/openFrameworks/branches{/branch}","tags_url":"https://api.github.com/repos/openframeworks/openFrameworks/tags","blobs_url":"https://api.github.com/repos/openframeworks/openFrameworks/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openframeworks/openFrameworks/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openframeworks/openFrameworks/git/refs{/sha}","trees_url":"https://api.github.com/repos/openframeworks/openFrameworks/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openframeworks/openFrameworks/statuses/{sha}","languages_url":"https://api.github.com/repos/openframeworks/openFrameworks/languages","stargazers_url":"https://api.github.com/repos/openframeworks/openFrameworks/stargazers","contributors_url":"https://api.github.com/repos/openframeworks/openFrameworks/contributors","subscribers_url":"https://api.github.com/repos/openframeworks/openFrameworks/subscribers","subscription_url":"https://api.github.com/repos/openframeworks/openFrameworks/subscription","commits_url":"https://api.github.com/repos/openframeworks/openFrameworks/commits{/sha}","git_commits_url":"https://api.github.com/repos/openframeworks/openFrameworks/git/commits{/sha}","comments_url":"https://api.github.com/repos/openframeworks/openFrameworks/comments{/number}","issue_comment_url":"https://api.github.com/repos/openframeworks/openFrameworks/issues/comments{/number}","contents_url":"https://api.github.com/repos/openframeworks/openFrameworks/contents/{+path}","compare_url":"https://api.github.com/repos/openframeworks/openFrameworks/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openframeworks/openFrameworks/merges","archive_url":"https://api.github.com/repos/openframeworks/openFrameworks/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openframeworks/openFrameworks/downloads","issues_url":"https://api.github.com/repos/openframeworks/openFrameworks/issues{/number}","pulls_url":"https://api.github.com/repos/openframeworks/openFrameworks/pulls{/number}","milestones_url":"https://api.github.com/repos/openframeworks/openFrameworks/milestones{/number}","notifications_url":"https://api.github.com/repos/openframeworks/openFrameworks/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openframeworks/openFrameworks/labels{/name}","releases_url":"https://api.github.com/repos/openframeworks/openFrameworks/releases{/id}","deployments_url":"https://api.github.com/repos/openframeworks/openFrameworks/deployments","created_at":"2009-10-21T21:55:54Z","updated_at":"2018-10-26T04:18:01Z","pushed_at":"2018-10-18T15:56:59Z","git_url":"git://github.com/openframeworks/openFrameworks.git","ssh_url":"[email protected]:openframeworks/openFrameworks.git","clone_url":"https://github.com/openframeworks/openFrameworks.git","svn_url":"https://github.com/openframeworks/openFrameworks","homepage":"http://openframeworks.cc","size":1997625,"stargazers_count":6453,"watchers_count":6453,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2143,"mirror_url":null,"archived":false,"open_issues_count":874,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":2143,"open_issues":874,"watchers":6453,"default_branch":"patch-release","permissions":{"admin":false,"push":false,"pull":true},"organization":{"login":"openframeworks","id":142866,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0Mjg2Ng==","avatar_url":"https://avatars2.githubusercontent.com/u/142866?v=4","gravatar_id":"","url":"https://api.github.com/users/openframeworks","html_url":"https://github.com/openframeworks","followers_url":"https://api.github.com/users/openframeworks/followers","following_url":"https://api.github.com/users/openframeworks/following{/other_user}","gists_url":"https://api.github.com/users/openframeworks/gists{/gist_id}","starred_url":"https://api.github.com/users/openframeworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openframeworks/subscriptions","organizations_url":"https://api.github.com/users/openframeworks/orgs","repos_url":"https://api.github.com/users/openframeworks/repos","events_url":"https://api.github.com/users/openframeworks/events{/privacy}","received_events_url":"https://api.github.com/users/openframeworks/received_events","type":"Organization","site_admin":false},"network_count":2143,"subscribers_count":514} | ||
|
22 changes: 22 additions & 0 deletions
22
github/tests/ReplayData/Issue945.testReservedPaginatedListAttributePreservation.txt
Large diffs are not rendered by default.
Oops, something went wrong.