diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f6b54044..1512f3d8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -40,7 +40,7 @@ You can run the tests through `python -m github.tests`. Run a specific test with `python -m github.tests TestCase` or `python -m github.tests TestCase.testMethod`. If you add a new test, for example `Issue139.testCompletion`, you must add an import in `github/tests/AllTests.py`. -Then, you have to run `python -m github.tests Issue139.testCompletion --record` to create the `github/tests/ReplayData/*.txt` files needed for you new test. +Then, you have to run `python -m github.tests Issue139.testCompletion --record` to create the `github/tests/ReplayData/*.txt` files needed for your new test. Check them and commit them as well. You will need a `GithubCredentials.py` file at the root of the project with the following contents: @@ -51,7 +51,13 @@ oauth_token = "my_token" # Can be left empty if not used ``` If you use 2 factor authentication on your Github account, tests that require a login/password authentication will fail. -You can use `python -m github.tests Issue139.testCompletion --record --auth_with_token` to use the `oauth_token` field specified in `GithubCredentials.py` when recording a unit test interaction. NB that the `password = ""` (empty string is ok) must still be present in `GithubCredentials.py` to run the tests even when the `--auth_with_token` arg is used. +You can use `python -m github.tests Issue139.testCompletion --record --auth_with_token` to use the `oauth_token` field specified in `GithubCredentials.py` when recording a unit test interaction. Note that the `password = ""` (empty string is ok) must still be present in `GithubCredentials.py` to run the tests even when the `--auth_with_token` arg is used. (Also note that if you record your test data with `--auth_with_token` then you also need to be in token authentication mode when running the test. A simple alternative it to replace `token private_token_removed` with `Basic login_and_password_removed` in all your newly generated ReplayData files.) + +To run manual tests with external scripts that use the PyGithub package, you can install your development version with: + +``` +pip install --editable path/to/project +``` ## Coding conventions diff --git a/github/Consts.py b/github/Consts.py index 1cf582b8..d0125e99 100644 --- a/github/Consts.py +++ b/github/Consts.py @@ -66,6 +66,9 @@ mediaTypeReactionsPreview = "application/vnd.github.squirrel-girl-preview" # https://developer.github.com/changes/2016-09-14-Integrations-Early-Access/ mediaTypeIntegrationPreview = "application/vnd.github.machine-man-preview+json" +# https://developer.github.com/changes/2016-09-14-projects-api/ +mediaTypeProjectsPreview = "application/vnd.github.inertia-preview+json" + # https://developer.github.com/changes/2017-01-05-commit-search-api/ mediaTypeCommitSearchPreview = "application/vnd.github.cloak-preview" diff --git a/github/MainClass.py b/github/MainClass.py index 3290f795..48f7ab8c 100644 --- a/github/MainClass.py +++ b/github/MainClass.py @@ -308,6 +308,19 @@ class Github(object): url_parameters ) + def get_project(self, id): + """ + :calls: `GET /projects/:project_id `_ + :rtype: :class:`github.Project.Project` + :param id: integer + """ + headers, data = self.__requester.requestJsonAndCheck( + "GET", + "/projects/%d" % (id), + headers={"Accept": Consts.mediaTypeProjectsPreview} + ) + return github.Project.Project(self.__requester, headers, data, completed=True) + def get_gist(self, id): """ :calls: `GET /gists/:id `_ diff --git a/github/Organization.py b/github/Organization.py index 853b47e4..b1051495 100644 --- a/github/Organization.py +++ b/github/Organization.py @@ -51,6 +51,7 @@ import github.Plan import github.Team import github.Event import github.Repository +import github.Project import github.NamedUser import Consts @@ -668,6 +669,25 @@ class Organization(github.GithubObject.CompletableGithubObject): url_parameters ) + def get_projects(self, state=github.GithubObject.NotSet): + """ + :calls: `GET /orgs/:org/projects `_ + :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Project.Project` + :param state: string + """ + + url_parameters = dict() + if state is not github.GithubObject.NotSet: + url_parameters["state"] = state + + return github.PaginatedList.PaginatedList( + github.Project.Project, + self._requester, + self.url + "/projects", + url_parameters, + {"Accept": Consts.mediaTypeProjectsPreview} + ) + def get_public_members(self): """ :calls: `GET /orgs/:org/public_members `_ diff --git a/github/Project.py b/github/Project.py new file mode 100644 index 00000000..cdfadc8b --- /dev/null +++ b/github/Project.py @@ -0,0 +1,200 @@ +# -*- coding: utf-8 -*- + +############################ Copyrights and license ############################ +# # +# Copyright 2018 bbi-yggy # +# # +# 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 . # +# # +################################################################################ + +import datetime +import json + +import github.GithubObject +import github.ProjectColumn + +import Consts + +class Project(github.GithubObject.CompletableGithubObject): + """ + This class represents Projects. The reference can be found here http://developer.github.com/v3/projects + """ + + def __repr__(self): + return self.get__repr__({"name": self._name.value}) + + @property + def body(self): + """ + :type: string + """ + self._completeIfNotSet(self._body) + return self._body.value + + @property + def columns_url(self): + """ + :type: string + """ + self._completeIfNotSet(self._columns_url) + return self._columns_url.value + + @property + def created_at(self): + """ + :type: datetime.datetime + """ + self._completeIfNotSet(self._created_at) + return self._created_at.value + + @property + def creator(self): + """ + :type: :class:`github.NamedUser.NamedUser` + """ + self._completeIfNotSet(self._creator) + return self._creator.value + + @property + def html_url(self): + """ + :type: string + """ + self._completeIfNotSet(self._html_url) + return self._html_url.value + + @property + def id(self): + """ + :type: integer + """ + self._completeIfNotSet(self._id) + return self._id.value + + @property + def name(self): + """ + :type: string + """ + self._completeIfNotSet(self._name) + return self._name.value + + @property + def node_id(self): + """ + :type: string + """ + self._completeIfNotSet(self._node_id) + return self._node_id.value + + @property + def number(self): + """ + :type: integer + """ + self._completeIfNotSet(self._number) + return self._number.value + + @property + def owner_url(self): + """ + :type: string + """ + self._completeIfNotSet(self._owner_url) + return self._owner_url.value + + @property + def state(self): + """ + :type: string + """ + self._completeIfNotSet(self._state) + return self._state.value + + @property + def updated_at(self): + """ + :type: datetime.datetime + """ + self._completeIfNotSet(self._updated_at) + return self._updated_at.value + + @property + def url(self): + """ + :type: string + """ + self._completeIfNotSet(self._url) + return self._url.value + + def get_columns(self): + """ + :calls: `GET /projects/:project_id/columns `_ + :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.ProjectColumn.ProjectColumn` + """ + + return github.PaginatedList.PaginatedList( + github.ProjectColumn.ProjectColumn, + self._requester, + self.columns_url, + None, + {"Accept": Consts.mediaTypeProjectsPreview} + ) + + def _initAttributes(self): + self._body = github.GithubObject.NotSet + self._columns_url = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._creator = github.GithubObject.NotSet + self._html_url = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._name = github.GithubObject.NotSet + self._node_id = github.GithubObject.NotSet + self._number = github.GithubObject.NotSet + self._owner_url = github.GithubObject.NotSet + self._state = github.GithubObject.NotSet + self._updated_at = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet + + def _useAttributes(self, attributes): + if "body" in attributes: # pragma no branch + self._body = self._makeStringAttribute(attributes["body"]) + if "columns_url" in attributes: # pragma no branch + self._columns_url = self._makeStringAttribute(attributes["columns_url"]) + if "created_at" in attributes: # pragma no branch + self._created_at = self._makeDatetimeAttribute(attributes["created_at"]) + if "creator" in attributes: # pragma no branch + self._creator = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["creator"]) + if "html_url" in attributes: # pragma no branch + self._html_url = self._makeStringAttribute(attributes["html_url"]) + if "id" in attributes: # pragma no branch + self._id = self._makeIntAttribute(attributes["id"]) + if "name" in attributes: # pragma no branch + self._name = self._makeStringAttribute(attributes["name"]) + if "node_id" in attributes: # pragma no branch + self._node_id = self._makeStringAttribute(attributes["node_id"]) + if "number" in attributes: # pragma no branch + self._number = self._makeIntAttribute(attributes["number"]) + if "owner_url" in attributes: # pragma no branch + self._owner_url = self._makeStringAttribute(attributes["owner_url"]) + if "state" in attributes: # pragma no branch + self._state = self._makeStringAttribute(attributes["state"]) + if "updated_at" in attributes: # pragma no branch + self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"]) + if "url" in attributes: # pragma no branch + self._url = self._makeStringAttribute(attributes["url"]) diff --git a/github/ProjectCard.py b/github/ProjectCard.py new file mode 100644 index 00000000..735ec3cb --- /dev/null +++ b/github/ProjectCard.py @@ -0,0 +1,170 @@ +# -*- coding: utf-8 -*- + +############################ Copyrights and license ############################ +# # +# Copyright 2018 bbi-yggy # +# # +# 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 . # +# # +################################################################################ + +import json + +import github.GithubObject + +# NOTE: There is currently no way to get cards "in triage" for a project. +# https://platform.github.community/t/moving-github-project-cards-that-are-in-triage/3784 +# +# See also https://developer.github.com/v4/object/projectcard for the next generation GitHub API, +# which may point the way to where the API is likely headed and what might come back to v3. E.g. ProjectCard.content member. +class ProjectCard(github.GithubObject.CompletableGithubObject): + """ + This class represents Project Cards. The reference can be found here https://developer.github.com/v3/projects/cards + """ + + def __repr__(self): + return self.get__repr__({"id": self._id.value}) + + @property + def archived(self): + """ + :type: bool + """ + return self._archived.value + + @property + def column_url(self): + """ + :type: string + """ + return self._column_url.value + + @property + def content_url(self): + """ + :type: string + """ + return self._content_url.value + + @property + def created_at(self): + """ + :type: datetime.datetime + """ + return self._created_at.value + + @property + def creator(self): + """ + :type: :class:`github.NamedUser.NamedUser` + """ + return self._creator.value + + @property + def id(self): + """ + :type: integer + """ + return self._id.value + + @property + def node_id(self): + """ + :type: string + """ + return self._node_id.value + + @property + def note(self): + """ + :type: string + """ + return self._note.value + + @property + def updated_at(self): + """ + :type: datetime.datetime + """ + return self._updated_at.value + + @property + def url(self): + """ + :type: string + """ + return self._url.value + + # Note that the content_url for any card will be an "issue" URL, from + # which you can retrieve either an Issue or a PullRequest. Unforunately + # the API doesn't make it clear which you are dealing with. + def get_content(self, content_type=github.GithubObject.NotSet): + """ + :calls: `GET /repos/:owner/:repo/pulls/:number `_ + :rtype: :class:`github.PullRequest.PullRequest` or :class:`github.Issue.Issue` + """ + if self.content_url == None: + return None + + if content_type == "PullRequest": + headers, data = self._requester.requestJsonAndCheck( + "GET", + self.content_url.replace("issues", "pulls") + ) + return github.PullRequest.PullRequest(self._requester, headers, data, completed=True) + elif content_type is github.GithubObject.NotSet or content_type == "Issue": + headers, data = self._requester.requestJsonAndCheck( + "GET", + self.content_url + ) + return github.Issue.Issue(self._requester, headers, data, completed=True) + else: + assert False, "Unknown content type: %s" % content_type + + def _initAttributes(self): + self._archived = github.GithubObject.NotSet + self._column_url = github.GithubObject.NotSet + self._content_url = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._creator = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._node_id = github.GithubObject.NotSet + self._note = github.GithubObject.NotSet + self._updated_at = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet + + def _useAttributes(self, attributes): + if "archived" in attributes: # pragma no branch + self._archived = self._makeBoolAttribute(attributes["archived"]) + if "column_url" in attributes: # pragma no branch + self._column_url = self._makeStringAttribute(attributes["column_url"]) + if "content_url" in attributes: # pragma no branch + self._content_url = self._makeStringAttribute(attributes["content_url"]) + if "created_at" in attributes: # pragma no branch + self._created_at = self._makeDatetimeAttribute(attributes["created_at"]) + if "creator" in attributes: # pragma no branch + self._creator = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["creator"]) + if "id" in attributes: # pragma no branch + self._id = self._makeIntAttribute(attributes["id"]) + if "node_id" in attributes: # pragma no branch + self._node_id = self._makeStringAttribute(attributes["node_id"]) + if "note" in attributes: # pragma no branch + self._note = self._makeStringAttribute(attributes["note"]) + if "updated_at" in attributes: # pragma no branch + self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"]) + if "url" in attributes: # pragma no branch + self._url = self._makeStringAttribute(attributes["url"]) diff --git a/github/ProjectColumn.py b/github/ProjectColumn.py new file mode 100644 index 00000000..702412e7 --- /dev/null +++ b/github/ProjectColumn.py @@ -0,0 +1,144 @@ +# -*- coding: utf-8 -*- + +############################ Copyrights and license ############################ +# # +# Copyright 2018 bbi-yggy # +# # +# 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 . # +# # +################################################################################ + +import json + +import github.GithubObject +import github.Project +import github.ProjectCard + +import Consts + +class ProjectColumn(github.GithubObject.CompletableGithubObject): + """ + This class represents Project Columns. The reference can be found here http://developer.github.com/v3/projects/columns + """ + + def __repr__(self): + return self.get__repr__({"name": self._name.value}) + + @property + def cards_url(self): + """ + :type: string + """ + return self._cards_url.value + + @property + def created_at(self): + """ + :type: datetime.datetime + """ + return self._created_at.value + + @property + def id(self): + """ + :type: integer + """ + return self._id.value + + @property + def name(self): + """ + :type: string + """ + return self._name.value + + @property + def node_id(self): + """ + :type: string + """ + return self._node_id.value + + @property + def project_url(self): + """ + :type: string + """ + return self._project_url.value + + @property + def updated_at(self): + """ + :type: datetime.datetime + """ + return self._updated_at.value + + @property + def url(self): + """ + :type: string + """ + return self._url.value + + def get_cards(self,archived_state=github.GithubObject.NotSet): + """ + :calls: `GET /projects/columns/:column_id/cards `_ + :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.ProjectCard.ProjectCard` + :param archived_state: string + """ + assert archived_state is github.GithubObject.NotSet or isinstance(archived_state, (str, unicode)), archived_state + + url_parameters = dict() + if archived_state is not github.GithubObject.NotSet: + url_parameters["archived_state"] = archived_state + + return github.PaginatedList.PaginatedList( + github.ProjectCard.ProjectCard, + self._requester, + self.url + "/cards", + url_parameters, + {"Accept": Consts.mediaTypeProjectsPreview} + ) + + def _initAttributes(self): + self._cards_url = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._name = github.GithubObject.NotSet + self._node_id = github.GithubObject.NotSet + self._project_url = github.GithubObject.NotSet + self._updated_at = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet + + def _useAttributes(self, attributes): + if "cards_url" in attributes: # pragma no branch + self._cards_url = self._makeStringAttribute(attributes["cards_url"]) + if "created_at" in attributes: # pragma no branch + self._created_at = self._makeDatetimeAttribute(attributes["created_at"]) + if "id" in attributes: # pragma no branch + self._id = self._makeIntAttribute(attributes["id"]) + if "name" in attributes: # pragma no branch + self._name = self._makeStringAttribute(attributes["name"]) + if "node_id" in attributes: # pragma no branch + self._node_id = self._makeStringAttribute(attributes["node_id"]) + if "project_url" in attributes: # pragma no branch + self._project_url = self._makeStringAttribute(attributes["project_url"]) + if "updated_at" in attributes: # pragma no branch + self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"]) + if "url" in attributes: # pragma no branch + self._url = self._makeStringAttribute(attributes["url"]) + diff --git a/github/Repository.py b/github/Repository.py index d0ea4590..4faec7be 100644 --- a/github/Repository.py +++ b/github/Repository.py @@ -102,6 +102,7 @@ import github.PullRequest import github.RepositoryKey import github.NamedUser import github.Milestone +import github.Project import github.Comparison import github.CommitComment import github.GitCommit @@ -1458,6 +1459,25 @@ class Repository(github.GithubObject.CompletableGithubObject): ] return github.ContentFile.ContentFile(self._requester, headers, data, completed=True) + def get_projects(self, state=github.GithubObject.NotSet): + """ + :calls: `GET /repos/:owner/:repo/projects `_ + :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Project.Project` + :param state: string + """ + + url_parameters = dict() + if state is not github.GithubObject.NotSet: + url_parameters["state"] = state + + return github.PaginatedList.PaginatedList( + github.Project.Project, + self._requester, + self.url + "/projects", + url_parameters, + {"Accept": Consts.mediaTypeProjectsPreview} + ) + def create_file(self, path, message, content, branch=github.GithubObject.NotSet, committer=github.GithubObject.NotSet, diff --git a/github/tests/AllTests.py b/github/tests/AllTests.py index eeb64f55..9d79fc71 100644 --- a/github/tests/AllTests.py +++ b/github/tests/AllTests.py @@ -73,6 +73,7 @@ from NamedUser import * from Markdown import * from OrganizationHasInMembers import * from Organization import * +from Project import * from PullRequest import * from PullRequestComment import * from PullRequestReview import * diff --git a/github/tests/Project.py b/github/tests/Project.py new file mode 100644 index 00000000..2e01d6e7 --- /dev/null +++ b/github/tests/Project.py @@ -0,0 +1,131 @@ +# -*- coding: utf-8 -*- + +# ########################## Copyrights and license ############################ +# # +# Copyright 2018 bbi-yggy # +# # +# This file is part of PyGithub. # +# http://pygithub.github.io/PyGithub/v1/index.html # +# # +# 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 . # +# # +# ############################################################################## + +import Framework +import github + +class Project(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.repo = self.g.get_user().get_repo('PyGithub') + + def testGetProject(self): + id = 1682941 + proj = self.g.get_project(id) + self.assertEqual(proj.id, id) + self.assertEqual(proj.name, 'TestProject') + + def testGetOrganizationProjects(self): + expectedProjects = ['Project1', 'Project2', 'Project3'] + org = self.g.get_organization('PyGithubTestOrg') + projects = [] + for proj in org.get_projects("open"): + projects.append(proj.name) + self.assertEqual(projects, expectedProjects) + + def testGetRepositoryProjects(self): + expectedProjects = ['TestProject', 'TestProjectClosed'] + projects = [] + for proj in self.repo.get_projects("all"): + projects.append(proj.name) + self.assertEqual(projects, expectedProjects) + + # See https://developer.github.com/v3/projects/#get-a-project + def testProjectAttributes(self): + id = 1682941 + proj = self.g.get_project(id) + self.assertEqual(proj.owner_url, "https://api.github.com/repos/bbi-yggy/PyGithub") + self.assertEqual(proj.url, "https://api.github.com/projects/1682941") + self.assertEqual(proj.html_url, "https://github.com/bbi-yggy/PyGithub/projects/1") + self.assertEqual(proj.columns_url, "https://api.github.com/projects/1682941/columns") + self.assertEqual(proj.id, id) + self.assertEqual(proj.node_id, "MDc6UHJvamVjdDE2ODI5NDE=") + self.assertEqual(proj.name, 'TestProject') + self.assertEqual(proj.body, "To be used for testing project access API for PyGithub.") + self.assertEqual(proj.number, 1) + self.assertEqual(proj.state, "open") + self.assertEqual(proj.creator, self.repo.owner) + self.assertEqual(proj.created_at.year, 2018) + self.assertTrue(proj.updated_at > proj.created_at) + + # See https://developer.github.com/v3/projects/columns/#get-a-project-column + def testProjectColumnAttributes(self): + proj = self.g.get_project(1682941) + col = proj.get_columns()[0] + self.assertEqual(col.id, 3138830) + self.assertEqual(col.node_id, "MDEzOlByb2plY3RDb2x1bW4zMTM4ODMw") + self.assertEqual(col.name, "To Do") + self.assertEqual(col.url, "https://api.github.com/projects/columns/3138830") + self.assertEqual(col.project_url, "https://api.github.com/projects/1682941") + self.assertEqual(col.cards_url, "https://api.github.com/projects/columns/3138830/cards") + self.assertEqual(col.created_at.year, 2018) + self.assertTrue(col.updated_at >= col.created_at) + + # See https://developer.github.com/v3/projects/cards/#get-a-project-card + def testProjectCardAttributes(self): + proj = self.g.get_project(1682941) + col = proj.get_columns()[1] + card = col.get_cards()[0] + self.assertEqual(card.url, "https://api.github.com/projects/columns/cards/11780055") + self.assertEqual(card.column_url, "https://api.github.com/projects/columns/3138831") + self.assertEqual(card.content_url, "https://api.github.com/repos/bbi-yggy/PyGithub/issues/1") + self.assertEqual(card.id, 11780055) + self.assertEqual(card.node_id, "MDExOlByb2plY3RDYXJkMTE3ODAwNTU=") + self.assertEqual(card.note, None) # No notes for cards with content. + self.assertEqual(card.creator, self.repo.owner) + self.assertEqual(card.created_at.year, 2018) + self.assertTrue(card.updated_at >= card.created_at) + self.assertFalse(card.archived) + + def testGetProjectCardContent(self): + proj = self.g.get_project(1682941) + col = proj.get_columns()[1] + cards = col.get_cards() + + pull_card = cards[0] + pull = pull_card.get_content("PullRequest") + self.assertIsInstance(pull, github.PullRequest.PullRequest); + self.assertEqual(pull.title, "Work in progress on support for GitHub projects API.") + + issue_card = cards[1] + issue = issue_card.get_content() + self.assertIsInstance(issue, github.Issue.Issue); + self.assertEqual(issue.title, "Test issue") + + note_card = cards[2] + note_content = note_card.get_content() + self.assertEqual(note_content, None) + + def testGetAllProjectCards(self): + expectedProjects = ['TestProject'] + expectedCards = 5 + projects = [] + cards = 0 + for proj in self.repo.get_projects(): + projects.append(proj.name) + for col in proj.get_columns(): + for card in col.get_cards("all"): + cards += 1 + self.assertEqual(projects, expectedProjects) + self.assertEqual(cards, expectedCards) diff --git a/github/tests/ReplayData/Project.setUp.txt b/github/tests/ReplayData/Project.setUp.txt new file mode 100644 index 00000000..a5b634c9 --- /dev/null +++ b/github/tests/ReplayData/Project.setUp.txt @@ -0,0 +1,22 @@ +https +GET +api.github.com +None +/user +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Date', 'Mon, 13 Aug 2018 20:46:31 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Server', 'GitHub.com'), ('Status', '200 OK'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4992'), ('X-RateLimit-Reset', '1534195928'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('ETag', 'W/"a7b881032dc3372f0757ab8399ffce75"'), ('Last-Modified', 'Fri, 27 Jul 2018 17:52:16 GMT'), ('X-OAuth-Scopes', 'read:org, read:user, repo, user:email'), ('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'"), ('X-Runtime-rack', '0.038446'), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'ED45:528D:FD186:146DB5:5B71EE27')] +{"login":"bbi-yggy","id":6392037,"node_id":"MDQ6VXNlcjYzOTIwMzc=","avatar_url":"https://avatars3.githubusercontent.com/u/6392037?v=4","gravatar_id":"","url":"https://api.github.com/users/bbi-yggy","html_url":"https://github.com/bbi-yggy","followers_url":"https://api.github.com/users/bbi-yggy/followers","following_url":"https://api.github.com/users/bbi-yggy/following{/other_user}","gists_url":"https://api.github.com/users/bbi-yggy/gists{/gist_id}","starred_url":"https://api.github.com/users/bbi-yggy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbi-yggy/subscriptions","organizations_url":"https://api.github.com/users/bbi-yggy/orgs","repos_url":"https://api.github.com/users/bbi-yggy/repos","events_url":"https://api.github.com/users/bbi-yggy/events{/privacy}","received_events_url":"https://api.github.com/users/bbi-yggy/received_events","type":"User","site_admin":false,"name":"Yossarian King","company":"Blackbird Interactive","blog":"","location":"Vancouver, Canada","email":null,"hireable":null,"bio":null,"public_repos":3,"public_gists":2,"followers":3,"following":1,"created_at":"2014-01-13T18:03:47Z","updated_at":"2018-07-27T17:52:16Z","private_gists":3,"total_private_repos":0,"owned_private_repos":0,"disk_usage":0,"collaborators":0,"two_factor_authentication":true,"plan":{"name":"free","space":976562499,"collaborators":0,"private_repos":0}} + +https +GET +api.github.com +None +/repos/bbi-yggy/PyGithub +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Date', 'Mon, 13 Aug 2018 20:46:31 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Server', 'GitHub.com'), ('Status', '200 OK'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4991'), ('X-RateLimit-Reset', '1534195928'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('ETag', 'W/"1a4d58b0c31a5e69747b7ad48d7a91ee"'), ('Last-Modified', 'Wed, 01 Aug 2018 05:11:35 GMT'), ('X-OAuth-Scopes', 'read:org, read:user, repo, user:email'), ('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'"), ('X-Runtime-rack', '0.077165'), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'ED5B:528C:C8555:10426C:5B71EE27')] +{"id":143089995,"node_id":"MDEwOlJlcG9zaXRvcnkxNDMwODk5OTU=","name":"PyGithub","full_name":"bbi-yggy/PyGithub","owner":{"login":"bbi-yggy","id":6392037,"node_id":"MDQ6VXNlcjYzOTIwMzc=","avatar_url":"https://avatars3.githubusercontent.com/u/6392037?v=4","gravatar_id":"","url":"https://api.github.com/users/bbi-yggy","html_url":"https://github.com/bbi-yggy","followers_url":"https://api.github.com/users/bbi-yggy/followers","following_url":"https://api.github.com/users/bbi-yggy/following{/other_user}","gists_url":"https://api.github.com/users/bbi-yggy/gists{/gist_id}","starred_url":"https://api.github.com/users/bbi-yggy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbi-yggy/subscriptions","organizations_url":"https://api.github.com/users/bbi-yggy/orgs","repos_url":"https://api.github.com/users/bbi-yggy/repos","events_url":"https://api.github.com/users/bbi-yggy/events{/privacy}","received_events_url":"https://api.github.com/users/bbi-yggy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bbi-yggy/PyGithub","description":"Typed interactions with the GitHub API v3","fork":true,"url":"https://api.github.com/repos/bbi-yggy/PyGithub","forks_url":"https://api.github.com/repos/bbi-yggy/PyGithub/forks","keys_url":"https://api.github.com/repos/bbi-yggy/PyGithub/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bbi-yggy/PyGithub/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bbi-yggy/PyGithub/teams","hooks_url":"https://api.github.com/repos/bbi-yggy/PyGithub/hooks","issue_events_url":"https://api.github.com/repos/bbi-yggy/PyGithub/issues/events{/number}","events_url":"https://api.github.com/repos/bbi-yggy/PyGithub/events","assignees_url":"https://api.github.com/repos/bbi-yggy/PyGithub/assignees{/user}","branches_url":"https://api.github.com/repos/bbi-yggy/PyGithub/branches{/branch}","tags_url":"https://api.github.com/repos/bbi-yggy/PyGithub/tags","blobs_url":"https://api.github.com/repos/bbi-yggy/PyGithub/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bbi-yggy/PyGithub/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bbi-yggy/PyGithub/git/refs{/sha}","trees_url":"https://api.github.com/repos/bbi-yggy/PyGithub/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bbi-yggy/PyGithub/statuses/{sha}","languages_url":"https://api.github.com/repos/bbi-yggy/PyGithub/languages","stargazers_url":"https://api.github.com/repos/bbi-yggy/PyGithub/stargazers","contributors_url":"https://api.github.com/repos/bbi-yggy/PyGithub/contributors","subscribers_url":"https://api.github.com/repos/bbi-yggy/PyGithub/subscribers","subscription_url":"https://api.github.com/repos/bbi-yggy/PyGithub/subscription","commits_url":"https://api.github.com/repos/bbi-yggy/PyGithub/commits{/sha}","git_commits_url":"https://api.github.com/repos/bbi-yggy/PyGithub/git/commits{/sha}","comments_url":"https://api.github.com/repos/bbi-yggy/PyGithub/comments{/number}","issue_comment_url":"https://api.github.com/repos/bbi-yggy/PyGithub/issues/comments{/number}","contents_url":"https://api.github.com/repos/bbi-yggy/PyGithub/contents/{+path}","compare_url":"https://api.github.com/repos/bbi-yggy/PyGithub/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bbi-yggy/PyGithub/merges","archive_url":"https://api.github.com/repos/bbi-yggy/PyGithub/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bbi-yggy/PyGithub/downloads","issues_url":"https://api.github.com/repos/bbi-yggy/PyGithub/issues{/number}","pulls_url":"https://api.github.com/repos/bbi-yggy/PyGithub/pulls{/number}","milestones_url":"https://api.github.com/repos/bbi-yggy/PyGithub/milestones{/number}","notifications_url":"https://api.github.com/repos/bbi-yggy/PyGithub/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bbi-yggy/PyGithub/labels{/name}","releases_url":"https://api.github.com/repos/bbi-yggy/PyGithub/releases{/id}","deployments_url":"https://api.github.com/repos/bbi-yggy/PyGithub/deployments","created_at":"2018-08-01T01:50:10Z","updated_at":"2018-08-01T05:11:35Z","pushed_at":"2018-08-13T19:19:24Z","git_url":"git://github.com/bbi-yggy/PyGithub.git","ssh_url":"git@github.com:bbi-yggy/PyGithub.git","clone_url":"https://github.com/bbi-yggy/PyGithub.git","svn_url":"https://github.com/bbi-yggy/PyGithub","homepage":"http://pygithub.readthedocs.io/","size":11292,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"lgpl-3.0","name":"GNU Lesser General Public License v3.0","spdx_id":"LGPL-3.0","url":"https://api.github.com/licenses/lgpl-3.0","node_id":"MDc6TGljZW5zZTEy"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master","permissions":{"admin":true,"push":true,"pull":true},"allow_squash_merge":true,"allow_merge_commit":true,"allow_rebase_merge":true,"parent":{"id":3544490,"node_id":"MDEwOlJlcG9zaXRvcnkzNTQ0NDkw","name":"PyGithub","full_name":"PyGithub/PyGithub","owner":{"login":"PyGithub","id":11288996,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExMjg4OTk2","avatar_url":"https://avatars0.githubusercontent.com/u/11288996?v=4","gravatar_id":"","url":"https://api.github.com/users/PyGithub","html_url":"https://github.com/PyGithub","followers_url":"https://api.github.com/users/PyGithub/followers","following_url":"https://api.github.com/users/PyGithub/following{/other_user}","gists_url":"https://api.github.com/users/PyGithub/gists{/gist_id}","starred_url":"https://api.github.com/users/PyGithub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PyGithub/subscriptions","organizations_url":"https://api.github.com/users/PyGithub/orgs","repos_url":"https://api.github.com/users/PyGithub/repos","events_url":"https://api.github.com/users/PyGithub/events{/privacy}","received_events_url":"https://api.github.com/users/PyGithub/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PyGithub/PyGithub","description":"Typed interactions with the GitHub API v3","fork":false,"url":"https://api.github.com/repos/PyGithub/PyGithub","forks_url":"https://api.github.com/repos/PyGithub/PyGithub/forks","keys_url":"https://api.github.com/repos/PyGithub/PyGithub/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PyGithub/PyGithub/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PyGithub/PyGithub/teams","hooks_url":"https://api.github.com/repos/PyGithub/PyGithub/hooks","issue_events_url":"https://api.github.com/repos/PyGithub/PyGithub/issues/events{/number}","events_url":"https://api.github.com/repos/PyGithub/PyGithub/events","assignees_url":"https://api.github.com/repos/PyGithub/PyGithub/assignees{/user}","branches_url":"https://api.github.com/repos/PyGithub/PyGithub/branches{/branch}","tags_url":"https://api.github.com/repos/PyGithub/PyGithub/tags","blobs_url":"https://api.github.com/repos/PyGithub/PyGithub/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PyGithub/PyGithub/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PyGithub/PyGithub/git/refs{/sha}","trees_url":"https://api.github.com/repos/PyGithub/PyGithub/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PyGithub/PyGithub/statuses/{sha}","languages_url":"https://api.github.com/repos/PyGithub/PyGithub/languages","stargazers_url":"https://api.github.com/repos/PyGithub/PyGithub/stargazers","contributors_url":"https://api.github.com/repos/PyGithub/PyGithub/contributors","subscribers_url":"https://api.github.com/repos/PyGithub/PyGithub/subscribers","subscription_url":"https://api.github.com/repos/PyGithub/PyGithub/subscription","commits_url":"https://api.github.com/repos/PyGithub/PyGithub/commits{/sha}","git_commits_url":"https://api.github.com/repos/PyGithub/PyGithub/git/commits{/sha}","comments_url":"https://api.github.com/repos/PyGithub/PyGithub/comments{/number}","issue_comment_url":"https://api.github.com/repos/PyGithub/PyGithub/issues/comments{/number}","contents_url":"https://api.github.com/repos/PyGithub/PyGithub/contents/{+path}","compare_url":"https://api.github.com/repos/PyGithub/PyGithub/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PyGithub/PyGithub/merges","archive_url":"https://api.github.com/repos/PyGithub/PyGithub/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PyGithub/PyGithub/downloads","issues_url":"https://api.github.com/repos/PyGithub/PyGithub/issues{/number}","pulls_url":"https://api.github.com/repos/PyGithub/PyGithub/pulls{/number}","milestones_url":"https://api.github.com/repos/PyGithub/PyGithub/milestones{/number}","notifications_url":"https://api.github.com/repos/PyGithub/PyGithub/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PyGithub/PyGithub/labels{/name}","releases_url":"https://api.github.com/repos/PyGithub/PyGithub/releases{/id}","deployments_url":"https://api.github.com/repos/PyGithub/PyGithub/deployments","created_at":"2012-02-25T12:53:47Z","updated_at":"2018-08-13T19:07:20Z","pushed_at":"2018-08-13T19:19:26Z","git_url":"git://github.com/PyGithub/PyGithub.git","ssh_url":"git@github.com:PyGithub/PyGithub.git","clone_url":"https://github.com/PyGithub/PyGithub.git","svn_url":"https://github.com/PyGithub/PyGithub","homepage":"http://pygithub.readthedocs.io/","size":11205,"stargazers_count":1976,"watchers_count":1976,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":691,"mirror_url":null,"archived":false,"open_issues_count":103,"license":{"key":"lgpl-3.0","name":"GNU Lesser General Public License v3.0","spdx_id":"LGPL-3.0","url":"https://api.github.com/licenses/lgpl-3.0","node_id":"MDc6TGljZW5zZTEy"},"forks":691,"open_issues":103,"watchers":1976,"default_branch":"master"},"source":{"id":3544490,"node_id":"MDEwOlJlcG9zaXRvcnkzNTQ0NDkw","name":"PyGithub","full_name":"PyGithub/PyGithub","owner":{"login":"PyGithub","id":11288996,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExMjg4OTk2","avatar_url":"https://avatars0.githubusercontent.com/u/11288996?v=4","gravatar_id":"","url":"https://api.github.com/users/PyGithub","html_url":"https://github.com/PyGithub","followers_url":"https://api.github.com/users/PyGithub/followers","following_url":"https://api.github.com/users/PyGithub/following{/other_user}","gists_url":"https://api.github.com/users/PyGithub/gists{/gist_id}","starred_url":"https://api.github.com/users/PyGithub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PyGithub/subscriptions","organizations_url":"https://api.github.com/users/PyGithub/orgs","repos_url":"https://api.github.com/users/PyGithub/repos","events_url":"https://api.github.com/users/PyGithub/events{/privacy}","received_events_url":"https://api.github.com/users/PyGithub/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PyGithub/PyGithub","description":"Typed interactions with the GitHub API v3","fork":false,"url":"https://api.github.com/repos/PyGithub/PyGithub","forks_url":"https://api.github.com/repos/PyGithub/PyGithub/forks","keys_url":"https://api.github.com/repos/PyGithub/PyGithub/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PyGithub/PyGithub/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PyGithub/PyGithub/teams","hooks_url":"https://api.github.com/repos/PyGithub/PyGithub/hooks","issue_events_url":"https://api.github.com/repos/PyGithub/PyGithub/issues/events{/number}","events_url":"https://api.github.com/repos/PyGithub/PyGithub/events","assignees_url":"https://api.github.com/repos/PyGithub/PyGithub/assignees{/user}","branches_url":"https://api.github.com/repos/PyGithub/PyGithub/branches{/branch}","tags_url":"https://api.github.com/repos/PyGithub/PyGithub/tags","blobs_url":"https://api.github.com/repos/PyGithub/PyGithub/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PyGithub/PyGithub/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PyGithub/PyGithub/git/refs{/sha}","trees_url":"https://api.github.com/repos/PyGithub/PyGithub/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PyGithub/PyGithub/statuses/{sha}","languages_url":"https://api.github.com/repos/PyGithub/PyGithub/languages","stargazers_url":"https://api.github.com/repos/PyGithub/PyGithub/stargazers","contributors_url":"https://api.github.com/repos/PyGithub/PyGithub/contributors","subscribers_url":"https://api.github.com/repos/PyGithub/PyGithub/subscribers","subscription_url":"https://api.github.com/repos/PyGithub/PyGithub/subscription","commits_url":"https://api.github.com/repos/PyGithub/PyGithub/commits{/sha}","git_commits_url":"https://api.github.com/repos/PyGithub/PyGithub/git/commits{/sha}","comments_url":"https://api.github.com/repos/PyGithub/PyGithub/comments{/number}","issue_comment_url":"https://api.github.com/repos/PyGithub/PyGithub/issues/comments{/number}","contents_url":"https://api.github.com/repos/PyGithub/PyGithub/contents/{+path}","compare_url":"https://api.github.com/repos/PyGithub/PyGithub/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PyGithub/PyGithub/merges","archive_url":"https://api.github.com/repos/PyGithub/PyGithub/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PyGithub/PyGithub/downloads","issues_url":"https://api.github.com/repos/PyGithub/PyGithub/issues{/number}","pulls_url":"https://api.github.com/repos/PyGithub/PyGithub/pulls{/number}","milestones_url":"https://api.github.com/repos/PyGithub/PyGithub/milestones{/number}","notifications_url":"https://api.github.com/repos/PyGithub/PyGithub/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PyGithub/PyGithub/labels{/name}","releases_url":"https://api.github.com/repos/PyGithub/PyGithub/releases{/id}","deployments_url":"https://api.github.com/repos/PyGithub/PyGithub/deployments","created_at":"2012-02-25T12:53:47Z","updated_at":"2018-08-13T19:07:20Z","pushed_at":"2018-08-13T19:19:26Z","git_url":"git://github.com/PyGithub/PyGithub.git","ssh_url":"git@github.com:PyGithub/PyGithub.git","clone_url":"https://github.com/PyGithub/PyGithub.git","svn_url":"https://github.com/PyGithub/PyGithub","homepage":"http://pygithub.readthedocs.io/","size":11205,"stargazers_count":1976,"watchers_count":1976,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":691,"mirror_url":null,"archived":false,"open_issues_count":103,"license":{"key":"lgpl-3.0","name":"GNU Lesser General Public License v3.0","spdx_id":"LGPL-3.0","url":"https://api.github.com/licenses/lgpl-3.0","node_id":"MDc6TGljZW5zZTEy"},"forks":691,"open_issues":103,"watchers":1976,"default_branch":"master"},"network_count":691,"subscribers_count":0} + diff --git a/github/tests/ReplayData/Project.testGetAllProjectCards.txt b/github/tests/ReplayData/Project.testGetAllProjectCards.txt new file mode 100644 index 00000000..3dbd6fd9 --- /dev/null +++ b/github/tests/ReplayData/Project.testGetAllProjectCards.txt @@ -0,0 +1,55 @@ +https +GET +api.github.com +None +/repos/bbi-yggy/PyGithub/projects +{'Accept': 'application/vnd.github.inertia-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Server', 'GitHub.com'), ('Date', 'Mon, 13 Aug 2018 05:39:12 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Status', '200 OK'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4969'), ('X-RateLimit-Reset', '1534141409'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP'), ('ETag', 'W/"b0ea2d53fb5efdd6747efd4f3624c4b7"'), ('X-OAuth-Scopes', 'repo'), ('X-Accepted-OAuth-Scopes', 'public_repo, repo'), ('X-GitHub-Media-Type', 'github.inertia-preview; 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'"), ('X-Runtime-rack', '0.076096'), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'DFA6:5F7A:7E00E:F625D:5B711980')] +[{"owner_url":"https://api.github.com/repos/bbi-yggy/PyGithub","url":"https://api.github.com/projects/1682941","html_url":"https://github.com/bbi-yggy/PyGithub/projects/1","columns_url":"https://api.github.com/projects/1682941/columns","id":1682941,"node_id":"MDc6UHJvamVjdDE2ODI5NDE=","name":"TestProject","body":"To be used for testing project access API for PyGithub.","number":1,"state":"open","creator":{"login":"bbi-yggy","id":6392037,"node_id":"MDQ6VXNlcjYzOTIwMzc=","avatar_url":"https://avatars3.githubusercontent.com/u/6392037?v=4","gravatar_id":"","url":"https://api.github.com/users/bbi-yggy","html_url":"https://github.com/bbi-yggy","followers_url":"https://api.github.com/users/bbi-yggy/followers","following_url":"https://api.github.com/users/bbi-yggy/following{/other_user}","gists_url":"https://api.github.com/users/bbi-yggy/gists{/gist_id}","starred_url":"https://api.github.com/users/bbi-yggy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbi-yggy/subscriptions","organizations_url":"https://api.github.com/users/bbi-yggy/orgs","repos_url":"https://api.github.com/users/bbi-yggy/repos","events_url":"https://api.github.com/users/bbi-yggy/events{/privacy}","received_events_url":"https://api.github.com/users/bbi-yggy/received_events","type":"User","site_admin":false},"created_at":"2018-08-01T04:06:57Z","updated_at":"2018-08-13T05:36:20Z"}] + +https +GET +api.github.com +None +/projects/1682941/columns +{'Accept': 'application/vnd.github.inertia-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Server', 'GitHub.com'), ('Date', 'Mon, 13 Aug 2018 05:39:13 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Status', '200 OK'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4968'), ('X-RateLimit-Reset', '1534141409'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP'), ('ETag', 'W/"8dd5e78506cda4651bd07cd8fa379ee4"'), ('X-OAuth-Scopes', 'repo'), ('X-Accepted-OAuth-Scopes', 'public_repo, repo'), ('X-GitHub-Media-Type', 'github.inertia-preview; 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'"), ('X-Runtime-rack', '0.070470'), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'DFA7:5F78:53816:C752C:5B711981')] +[{"url":"https://api.github.com/projects/columns/3138830","project_url":"https://api.github.com/projects/1682941","cards_url":"https://api.github.com/projects/columns/3138830/cards","id":3138830,"node_id":"MDEzOlByb2plY3RDb2x1bW4zMTM4ODMw","name":"To Do","created_at":"2018-08-01T04:07:35Z","updated_at":"2018-08-01T04:07:35Z"},{"url":"https://api.github.com/projects/columns/3138831","project_url":"https://api.github.com/projects/1682941","cards_url":"https://api.github.com/projects/columns/3138831/cards","id":3138831,"node_id":"MDEzOlByb2plY3RDb2x1bW4zMTM4ODMx","name":"In Progress","created_at":"2018-08-01T04:07:43Z","updated_at":"2018-08-13T05:36:20Z"},{"url":"https://api.github.com/projects/columns/3138832","project_url":"https://api.github.com/projects/1682941","cards_url":"https://api.github.com/projects/columns/3138832/cards","id":3138832,"node_id":"MDEzOlByb2plY3RDb2x1bW4zMTM4ODMy","name":"Done","created_at":"2018-08-01T04:07:47Z","updated_at":"2018-08-03T00:31:17Z"}] + +https +GET +api.github.com +None +/projects/columns/3138830/cards?archived_state=all +{'Accept': 'application/vnd.github.inertia-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Server', 'GitHub.com'), ('Date', 'Mon, 13 Aug 2018 05:39:13 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Status', '200 OK'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4967'), ('X-RateLimit-Reset', '1534141409'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP'), ('ETag', 'W/"faf8aa258c610a3c75793f891cae5663"'), ('X-OAuth-Scopes', 'repo'), ('X-Accepted-OAuth-Scopes', 'public_repo, repo'), ('X-GitHub-Media-Type', 'github.inertia-preview; 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'"), ('X-Runtime-rack', '0.067177'), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'DFA8:5F78:53826:C7559:5B711981')] +[{"url":"https://api.github.com/projects/columns/cards/11779470","id":11779470,"node_id":"MDExOlByb2plY3RDYXJkMTE3Nzk0NzA=","note":"Note: first note added. This card has no corresponding issue or pull request.","archived":false,"creator":{"login":"bbi-yggy","id":6392037,"node_id":"MDQ6VXNlcjYzOTIwMzc=","avatar_url":"https://avatars3.githubusercontent.com/u/6392037?v=4","gravatar_id":"","url":"https://api.github.com/users/bbi-yggy","html_url":"https://github.com/bbi-yggy","followers_url":"https://api.github.com/users/bbi-yggy/followers","following_url":"https://api.github.com/users/bbi-yggy/following{/other_user}","gists_url":"https://api.github.com/users/bbi-yggy/gists{/gist_id}","starred_url":"https://api.github.com/users/bbi-yggy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbi-yggy/subscriptions","organizations_url":"https://api.github.com/users/bbi-yggy/orgs","repos_url":"https://api.github.com/users/bbi-yggy/repos","events_url":"https://api.github.com/users/bbi-yggy/events{/privacy}","received_events_url":"https://api.github.com/users/bbi-yggy/received_events","type":"User","site_admin":false},"created_at":"2018-08-01T04:08:33Z","updated_at":"2018-08-01T04:08:33Z","column_url":"https://api.github.com/projects/columns/3138830"}] + +https +GET +api.github.com +None +/projects/columns/3138831/cards?archived_state=all +{'Accept': 'application/vnd.github.inertia-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Server', 'GitHub.com'), ('Date', 'Mon, 13 Aug 2018 05:39:14 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Status', '200 OK'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4966'), ('X-RateLimit-Reset', '1534141409'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP'), ('ETag', 'W/"1f2154027a27c2b24b5ebc62a686678a"'), ('X-OAuth-Scopes', 'repo'), ('X-Accepted-OAuth-Scopes', 'public_repo, repo'), ('X-GitHub-Media-Type', 'github.inertia-preview; 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'"), ('X-Runtime-rack', '0.122778'), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'DFA9:5F71:1803F:413A2:5B711981')] +[{"url":"https://api.github.com/projects/columns/cards/11780055","id":11780055,"node_id":"MDExOlByb2plY3RDYXJkMTE3ODAwNTU=","note":null,"archived":false,"creator":{"login":"bbi-yggy","id":6392037,"node_id":"MDQ6VXNlcjYzOTIwMzc=","avatar_url":"https://avatars3.githubusercontent.com/u/6392037?v=4","gravatar_id":"","url":"https://api.github.com/users/bbi-yggy","html_url":"https://github.com/bbi-yggy","followers_url":"https://api.github.com/users/bbi-yggy/followers","following_url":"https://api.github.com/users/bbi-yggy/following{/other_user}","gists_url":"https://api.github.com/users/bbi-yggy/gists{/gist_id}","starred_url":"https://api.github.com/users/bbi-yggy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbi-yggy/subscriptions","organizations_url":"https://api.github.com/users/bbi-yggy/orgs","repos_url":"https://api.github.com/users/bbi-yggy/repos","events_url":"https://api.github.com/users/bbi-yggy/events{/privacy}","received_events_url":"https://api.github.com/users/bbi-yggy/received_events","type":"User","site_admin":false},"created_at":"2018-08-01T04:53:59Z","updated_at":"2018-08-01T04:54:16Z","column_url":"https://api.github.com/projects/columns/3138831","content_url":"https://api.github.com/repos/bbi-yggy/PyGithub/issues/1"},{"url":"https://api.github.com/projects/columns/cards/12078706","id":12078706,"node_id":"MDExOlByb2plY3RDYXJkMTIwNzg3MDY=","note":null,"archived":false,"creator":{"login":"bbi-yggy","id":6392037,"node_id":"MDQ6VXNlcjYzOTIwMzc=","avatar_url":"https://avatars3.githubusercontent.com/u/6392037?v=4","gravatar_id":"","url":"https://api.github.com/users/bbi-yggy","html_url":"https://github.com/bbi-yggy","followers_url":"https://api.github.com/users/bbi-yggy/followers","following_url":"https://api.github.com/users/bbi-yggy/following{/other_user}","gists_url":"https://api.github.com/users/bbi-yggy/gists{/gist_id}","starred_url":"https://api.github.com/users/bbi-yggy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbi-yggy/subscriptions","organizations_url":"https://api.github.com/users/bbi-yggy/orgs","repos_url":"https://api.github.com/users/bbi-yggy/repos","events_url":"https://api.github.com/users/bbi-yggy/events{/privacy}","received_events_url":"https://api.github.com/users/bbi-yggy/received_events","type":"User","site_admin":false},"created_at":"2018-08-13T04:46:29Z","updated_at":"2018-08-13T04:46:44Z","column_url":"https://api.github.com/projects/columns/3138831","content_url":"https://api.github.com/repos/bbi-yggy/PyGithub/issues/2"},{"url":"https://api.github.com/projects/columns/cards/12079385","id":12079385,"node_id":"MDExOlByb2plY3RDYXJkMTIwNzkzODU=","note":"Test note","archived":false,"creator":{"login":"bbi-yggy","id":6392037,"node_id":"MDQ6VXNlcjYzOTIwMzc=","avatar_url":"https://avatars3.githubusercontent.com/u/6392037?v=4","gravatar_id":"","url":"https://api.github.com/users/bbi-yggy","html_url":"https://github.com/bbi-yggy","followers_url":"https://api.github.com/users/bbi-yggy/followers","following_url":"https://api.github.com/users/bbi-yggy/following{/other_user}","gists_url":"https://api.github.com/users/bbi-yggy/gists{/gist_id}","starred_url":"https://api.github.com/users/bbi-yggy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbi-yggy/subscriptions","organizations_url":"https://api.github.com/users/bbi-yggy/orgs","repos_url":"https://api.github.com/users/bbi-yggy/repos","events_url":"https://api.github.com/users/bbi-yggy/events{/privacy}","received_events_url":"https://api.github.com/users/bbi-yggy/received_events","type":"User","site_admin":false},"created_at":"2018-08-13T05:36:13Z","updated_at":"2018-08-13T05:36:20Z","column_url":"https://api.github.com/projects/columns/3138831"}] + +https +GET +api.github.com +None +/projects/columns/3138832/cards?archived_state=all +{'Accept': 'application/vnd.github.inertia-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Server', 'GitHub.com'), ('Date', 'Mon, 13 Aug 2018 05:39:14 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Status', '200 OK'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4965'), ('X-RateLimit-Reset', '1534141409'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP'), ('ETag', 'W/"d07e05df9d6ccede8df4f7bf63454aab"'), ('X-OAuth-Scopes', 'repo'), ('X-Accepted-OAuth-Scopes', 'public_repo, repo'), ('X-GitHub-Media-Type', 'github.inertia-preview; 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'"), ('X-Runtime-rack', '0.071735'), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'DFAA:5F7A:7E094:F6359:5B711982')] +[{"url":"https://api.github.com/projects/columns/cards/11841716","id":11841716,"node_id":"MDExOlByb2plY3RDYXJkMTE4NDE3MTY=","note":"This note is Done.","archived":true,"creator":{"login":"bbi-yggy","id":6392037,"node_id":"MDQ6VXNlcjYzOTIwMzc=","avatar_url":"https://avatars3.githubusercontent.com/u/6392037?v=4","gravatar_id":"","url":"https://api.github.com/users/bbi-yggy","html_url":"https://github.com/bbi-yggy","followers_url":"https://api.github.com/users/bbi-yggy/followers","following_url":"https://api.github.com/users/bbi-yggy/following{/other_user}","gists_url":"https://api.github.com/users/bbi-yggy/gists{/gist_id}","starred_url":"https://api.github.com/users/bbi-yggy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbi-yggy/subscriptions","organizations_url":"https://api.github.com/users/bbi-yggy/orgs","repos_url":"https://api.github.com/users/bbi-yggy/repos","events_url":"https://api.github.com/users/bbi-yggy/events{/privacy}","received_events_url":"https://api.github.com/users/bbi-yggy/received_events","type":"User","site_admin":false},"created_at":"2018-08-03T00:30:46Z","updated_at":"2018-08-03T00:31:17Z","column_url":"https://api.github.com/projects/columns/3138832"}] + diff --git a/github/tests/ReplayData/Project.testGetOrganizationProjects.txt b/github/tests/ReplayData/Project.testGetOrganizationProjects.txt new file mode 100644 index 00000000..8f5f5de8 --- /dev/null +++ b/github/tests/ReplayData/Project.testGetOrganizationProjects.txt @@ -0,0 +1,22 @@ +https +GET +api.github.com +None +/orgs/PyGithubTestOrg +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Server', 'GitHub.com'), ('Date', 'Sat, 11 Aug 2018 04:59:31 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Status', '200 OK'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4984'), ('X-RateLimit-Reset', '1533965918'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP'), ('ETag', 'W/"5aadd27e349e1364c5686beabf625c25"'), ('Last-Modified', 'Tue, 07 Aug 2018 21:30:35 GMT'), ('X-OAuth-Scopes', 'repo'), ('X-Accepted-OAuth-Scopes', 'admin:org, read:org, repo, user, write:org'), ('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'"), ('X-Runtime-rack', '0.076932'), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'DB30:5AC6:C50C78:1BDB630:5B6E6D32')] +{"login":"PyGithubTestOrg","id":16930092,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2OTMwMDky","url":"https://api.github.com/orgs/PyGithubTestOrg","repos_url":"https://api.github.com/orgs/PyGithubTestOrg/repos","events_url":"https://api.github.com/orgs/PyGithubTestOrg/events","hooks_url":"https://api.github.com/orgs/PyGithubTestOrg/hooks","issues_url":"https://api.github.com/orgs/PyGithubTestOrg/issues","members_url":"https://api.github.com/orgs/PyGithubTestOrg/members{/member}","public_members_url":"https://api.github.com/orgs/PyGithubTestOrg/public_members{/member}","avatar_url":"https://avatars3.githubusercontent.com/u/16930092?v=4","description":"Blackbird Interactive is an independent game development studio dedicated to creating world-class, immersive, compelling and stylish interactive experiences.","name":"Blackbird Interactive Inc.","company":null,"blog":"http://PyGithubTestOrg.com","location":"Vancouver, BC, Canada","email":"support@PyGithubTestOrg.com","is_verified":false,"has_organization_projects":true,"has_repository_projects":true,"public_repos":1,"public_gists":0,"followers":0,"following":0,"html_url":"https://github.com/PyGithubTestOrg","created_at":"2016-01-28T03:12:31Z","updated_at":"2018-08-07T21:30:35Z","type":"Organization","total_private_repos":19,"owned_private_repos":18,"private_gists":0,"disk_usage":822154,"collaborators":10,"billing_email":"github@PyGithubTestOrg.com","plan":{"name":"silver","space":976562499,"private_repos":20,"filled_seats":76,"seats":0},"default_repository_permission":"none","members_can_create_repositories":false,"two_factor_requirement_enabled":false} + +https +GET +api.github.com +None +/orgs/PyGithubTestOrg/projects?state=open +{'Accept': 'application/vnd.github.inertia-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Server', 'GitHub.com'), ('Date', 'Sat, 11 Aug 2018 04:59:31 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Status', '200 OK'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4983'), ('X-RateLimit-Reset', '1533965918'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP'), ('ETag', 'W/"4b04fe124cbf0d6f615f1a889b057a2f"'), ('X-OAuth-Scopes', 'repo'), ('X-Accepted-OAuth-Scopes', ''), ('X-GitHub-Media-Type', 'github.inertia-preview; 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'"), ('X-Runtime-rack', '0.165079'), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'DB31:5AC6:C50C8C:1BDB65D:5B6E6D33')] +[{"owner_url":"https://api.github.com/orgs/PyGithubTestOrg","url":"https://api.github.com/projects/1085833","html_url":"https://github.com/orgs/PyGithubTestOrg/projects/1","columns_url":"https://api.github.com/projects/1085833/columns","id":1085833,"node_id":"MDc6UHJvamVjdDEwODU4MzM=","name":"Project1","body":"First test project.","number":1,"state":"open","creator":{"login":"bbi-yggy","id":6392037,"node_id":"MDQ6VXNlcjYzOTIwMzc=","avatar_url":"https://avatars3.githubusercontent.com/u/6392037?v=4","gravatar_id":"","url":"https://api.github.com/users/bbi-yggy","html_url":"https://github.com/bbi-yggy","followers_url":"https://api.github.com/users/bbi-yggy/followers","following_url":"https://api.github.com/users/bbi-yggy/following{/other_user}","gists_url":"https://api.github.com/users/bbi-yggy/gists{/gist_id}","starred_url":"https://api.github.com/users/bbi-yggy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbi-yggy/subscriptions","organizations_url":"https://api.github.com/users/bbi-yggy/orgs","repos_url":"https://api.github.com/users/bbi-yggy/repos","events_url":"https://api.github.com/users/bbi-yggy/events{/privacy}","received_events_url":"https://api.github.com/users/bbi-yggy/received_events","type":"User","site_admin":false},"created_at":"2017-11-21T23:03:55Z","updated_at":"2018-08-02T20:56:37Z","organization_permission":"write","private":true},{"owner_url":"https://api.github.com/orgs/PyGithubTestOrg","url":"https://api.github.com/projects/1085834","html_url":"https://github.com/orgs/PyGithubTestOrg/projects/2","columns_url":"https://api.github.com/projects/1085834/columns","id":1085834,"node_id":"MDc6UHJvamVjdDEwODU4MzQ=","name":"Project2","body":"Second test project.","number":2,"state":"open","creator":{"login":"bbi-yggy","id":6392037,"node_id":"MDQ6VXNlcjYzOTIwMzc=","avatar_url":"https://avatars3.githubusercontent.com/u/6392037?v=4","gravatar_id":"","url":"https://api.github.com/users/bbi-yggy","html_url":"https://github.com/bbi-yggy","followers_url":"https://api.github.com/users/bbi-yggy/followers","following_url":"https://api.github.com/users/bbi-yggy/following{/other_user}","gists_url":"https://api.github.com/users/bbi-yggy/gists{/gist_id}","starred_url":"https://api.github.com/users/bbi-yggy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbi-yggy/subscriptions","organizations_url":"https://api.github.com/users/bbi-yggy/orgs","repos_url":"https://api.github.com/users/bbi-yggy/repos","events_url":"https://api.github.com/users/bbi-yggy/events{/privacy}","received_events_url":"https://api.github.com/users/bbi-yggy/received_events","type":"User","site_admin":false},"created_at":"2017-11-21T23:04:43Z","updated_at":"2018-07-30T23:20:19Z","organization_permission":"read","private":true},{"owner_url":"https://api.github.com/orgs/PyGithubTestOrg","url":"https://api.github.com/projects/1623594","html_url":"https://github.com/orgs/PyGithubTestOrg/projects/3","columns_url":"https://api.github.com/projects/1623594/columns","id":1623594,"node_id":"MDc6UHJvamVjdDE2MjM1OTQ=","name":"Project3","body":"Third test project","number":3,"state":"open","creator":{"login":"bbi-yggy","id":6392037,"node_id":"MDQ6VXNlcjYzOTIwMzc=","avatar_url":"https://avatars3.githubusercontent.com/u/6392037?v=4","gravatar_id":"","url":"https://api.github.com/users/bbi-yggy","html_url":"https://github.com/bbi-yggy","followers_url":"https://api.github.com/users/bbi-yggy/followers","following_url":"https://api.github.com/users/bbi-yggy/following{/other_user}","gists_url":"https://api.github.com/users/bbi-yggy/gists{/gist_id}","starred_url":"https://api.github.com/users/bbi-yggy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbi-yggy/subscriptions","organizations_url":"https://api.github.com/users/bbi-yggy/orgs","repos_url":"https://api.github.com/users/bbi-yggy/repos","events_url":"https://api.github.com/users/bbi-yggy/events{/privacy}","received_events_url":"https://api.github.com/users/bbi-yggy/received_events","type":"User","site_admin":false},"created_at":"2018-07-04T04:21:58Z","updated_at":"2018-08-03T21:52:04Z","organization_permission":"write","private":true}] + diff --git a/github/tests/ReplayData/Project.testGetProject.txt b/github/tests/ReplayData/Project.testGetProject.txt new file mode 100644 index 00000000..99c15466 --- /dev/null +++ b/github/tests/ReplayData/Project.testGetProject.txt @@ -0,0 +1,11 @@ +https +GET +api.github.com +None +/projects/1682941 +{'Accept': 'application/vnd.github.inertia-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Server', 'GitHub.com'), ('Date', 'Sat, 11 Aug 2018 05:11:57 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Status', '200 OK'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4977'), ('X-RateLimit-Reset', '1533965918'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP'), ('ETag', 'W/"27943de4706a46a49435f50612ed14a7"'), ('X-OAuth-Scopes', 'repo'), ('X-Accepted-OAuth-Scopes', 'public_repo, repo'), ('X-GitHub-Media-Type', 'github.inertia-preview; 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'"), ('X-Runtime-rack', '0.073652'), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'DB5F:5AC5:10682C2:21382ED:5B6E701D')] +{"owner_url":"https://api.github.com/repos/bbi-yggy/PyGithub","url":"https://api.github.com/projects/1682941","html_url":"https://github.com/bbi-yggy/PyGithub/projects/1","columns_url":"https://api.github.com/projects/1682941/columns","id":1682941,"node_id":"MDc6UHJvamVjdDE2ODI5NDE=","name":"TestProject","body":"To be used for testing project access API for PyGithub.","number":1,"state":"open","creator":{"login":"bbi-yggy","id":6392037,"node_id":"MDQ6VXNlcjYzOTIwMzc=","avatar_url":"https://avatars3.githubusercontent.com/u/6392037?v=4","gravatar_id":"","url":"https://api.github.com/users/bbi-yggy","html_url":"https://github.com/bbi-yggy","followers_url":"https://api.github.com/users/bbi-yggy/followers","following_url":"https://api.github.com/users/bbi-yggy/following{/other_user}","gists_url":"https://api.github.com/users/bbi-yggy/gists{/gist_id}","starred_url":"https://api.github.com/users/bbi-yggy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbi-yggy/subscriptions","organizations_url":"https://api.github.com/users/bbi-yggy/orgs","repos_url":"https://api.github.com/users/bbi-yggy/repos","events_url":"https://api.github.com/users/bbi-yggy/events{/privacy}","received_events_url":"https://api.github.com/users/bbi-yggy/received_events","type":"User","site_admin":false},"created_at":"2018-08-01T04:06:57Z","updated_at":"2018-08-03T00:31:17Z"} + diff --git a/github/tests/ReplayData/Project.testGetProjectCardContent.txt b/github/tests/ReplayData/Project.testGetProjectCardContent.txt new file mode 100644 index 00000000..779646af --- /dev/null +++ b/github/tests/ReplayData/Project.testGetProjectCardContent.txt @@ -0,0 +1,55 @@ +https +GET +api.github.com +None +/projects/1682941 +{'Accept': 'application/vnd.github.inertia-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Date', 'Mon, 13 Aug 2018 20:46:31 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Server', 'GitHub.com'), ('Status', '200 OK'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4990'), ('X-RateLimit-Reset', '1534195928'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('ETag', 'W/"d41667487e81d823d4dfd11da0547f36"'), ('X-OAuth-Scopes', 'read:org, read:user, repo, user:email'), ('X-Accepted-OAuth-Scopes', 'public_repo, repo'), ('X-GitHub-Media-Type', 'github.inertia-preview; 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'"), ('X-Runtime-rack', '0.074803'), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'ED5E:528C:C8567:104287:5B71EE27')] +{"owner_url":"https://api.github.com/repos/bbi-yggy/PyGithub","url":"https://api.github.com/projects/1682941","html_url":"https://github.com/bbi-yggy/PyGithub/projects/1","columns_url":"https://api.github.com/projects/1682941/columns","id":1682941,"node_id":"MDc6UHJvamVjdDE2ODI5NDE=","name":"TestProject","body":"To be used for testing project access API for PyGithub.","number":1,"state":"open","creator":{"login":"bbi-yggy","id":6392037,"node_id":"MDQ6VXNlcjYzOTIwMzc=","avatar_url":"https://avatars3.githubusercontent.com/u/6392037?v=4","gravatar_id":"","url":"https://api.github.com/users/bbi-yggy","html_url":"https://github.com/bbi-yggy","followers_url":"https://api.github.com/users/bbi-yggy/followers","following_url":"https://api.github.com/users/bbi-yggy/following{/other_user}","gists_url":"https://api.github.com/users/bbi-yggy/gists{/gist_id}","starred_url":"https://api.github.com/users/bbi-yggy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbi-yggy/subscriptions","organizations_url":"https://api.github.com/users/bbi-yggy/orgs","repos_url":"https://api.github.com/users/bbi-yggy/repos","events_url":"https://api.github.com/users/bbi-yggy/events{/privacy}","received_events_url":"https://api.github.com/users/bbi-yggy/received_events","type":"User","site_admin":false},"created_at":"2018-08-01T04:06:57Z","updated_at":"2018-08-13T05:36:20Z"} + +https +GET +api.github.com +None +/projects/1682941/columns +{'Accept': 'application/vnd.github.inertia-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Date', 'Mon, 13 Aug 2018 20:46:31 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Server', 'GitHub.com'), ('Status', '200 OK'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4989'), ('X-RateLimit-Reset', '1534195928'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('ETag', 'W/"2651dd36184e34861070c99961911f72"'), ('X-OAuth-Scopes', 'read:org, read:user, repo, user:email'), ('X-Accepted-OAuth-Scopes', 'public_repo, repo'), ('X-GitHub-Media-Type', 'github.inertia-preview; 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'"), ('X-Runtime-rack', '0.068263'), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'EDAB:528C:C8574:104296:5B71EE27')] +[{"url":"https://api.github.com/projects/columns/3138830","project_url":"https://api.github.com/projects/1682941","cards_url":"https://api.github.com/projects/columns/3138830/cards","id":3138830,"node_id":"MDEzOlByb2plY3RDb2x1bW4zMTM4ODMw","name":"To Do","created_at":"2018-08-01T04:07:35Z","updated_at":"2018-08-01T04:07:35Z"},{"url":"https://api.github.com/projects/columns/3138831","project_url":"https://api.github.com/projects/1682941","cards_url":"https://api.github.com/projects/columns/3138831/cards","id":3138831,"node_id":"MDEzOlByb2plY3RDb2x1bW4zMTM4ODMx","name":"In Progress","created_at":"2018-08-01T04:07:43Z","updated_at":"2018-08-13T05:36:20Z"},{"url":"https://api.github.com/projects/columns/3138832","project_url":"https://api.github.com/projects/1682941","cards_url":"https://api.github.com/projects/columns/3138832/cards","id":3138832,"node_id":"MDEzOlByb2plY3RDb2x1bW4zMTM4ODMy","name":"Done","created_at":"2018-08-01T04:07:47Z","updated_at":"2018-08-03T00:31:17Z"}] + +https +GET +api.github.com +None +/projects/columns/3138831/cards +{'Accept': 'application/vnd.github.inertia-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Date', 'Mon, 13 Aug 2018 20:46:32 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Server', 'GitHub.com'), ('Status', '200 OK'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4988'), ('X-RateLimit-Reset', '1534195928'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('ETag', 'W/"b34981c73fa8d0ac5117df1816b3548f"'), ('X-OAuth-Scopes', 'read:org, read:user, repo, user:email'), ('X-Accepted-OAuth-Scopes', 'public_repo, repo'), ('X-GitHub-Media-Type', 'github.inertia-preview; 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'"), ('X-Runtime-rack', '0.133604'), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'EDCD:528D:FD1E6:146E30:5B71EE27')] +[{"url":"https://api.github.com/projects/columns/cards/11780055","id":11780055,"node_id":"MDExOlByb2plY3RDYXJkMTE3ODAwNTU=","note":null,"archived":false,"creator":{"login":"bbi-yggy","id":6392037,"node_id":"MDQ6VXNlcjYzOTIwMzc=","avatar_url":"https://avatars3.githubusercontent.com/u/6392037?v=4","gravatar_id":"","url":"https://api.github.com/users/bbi-yggy","html_url":"https://github.com/bbi-yggy","followers_url":"https://api.github.com/users/bbi-yggy/followers","following_url":"https://api.github.com/users/bbi-yggy/following{/other_user}","gists_url":"https://api.github.com/users/bbi-yggy/gists{/gist_id}","starred_url":"https://api.github.com/users/bbi-yggy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbi-yggy/subscriptions","organizations_url":"https://api.github.com/users/bbi-yggy/orgs","repos_url":"https://api.github.com/users/bbi-yggy/repos","events_url":"https://api.github.com/users/bbi-yggy/events{/privacy}","received_events_url":"https://api.github.com/users/bbi-yggy/received_events","type":"User","site_admin":false},"created_at":"2018-08-01T04:53:59Z","updated_at":"2018-08-01T04:54:16Z","column_url":"https://api.github.com/projects/columns/3138831","content_url":"https://api.github.com/repos/bbi-yggy/PyGithub/issues/1"},{"url":"https://api.github.com/projects/columns/cards/12078706","id":12078706,"node_id":"MDExOlByb2plY3RDYXJkMTIwNzg3MDY=","note":null,"archived":false,"creator":{"login":"bbi-yggy","id":6392037,"node_id":"MDQ6VXNlcjYzOTIwMzc=","avatar_url":"https://avatars3.githubusercontent.com/u/6392037?v=4","gravatar_id":"","url":"https://api.github.com/users/bbi-yggy","html_url":"https://github.com/bbi-yggy","followers_url":"https://api.github.com/users/bbi-yggy/followers","following_url":"https://api.github.com/users/bbi-yggy/following{/other_user}","gists_url":"https://api.github.com/users/bbi-yggy/gists{/gist_id}","starred_url":"https://api.github.com/users/bbi-yggy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbi-yggy/subscriptions","organizations_url":"https://api.github.com/users/bbi-yggy/orgs","repos_url":"https://api.github.com/users/bbi-yggy/repos","events_url":"https://api.github.com/users/bbi-yggy/events{/privacy}","received_events_url":"https://api.github.com/users/bbi-yggy/received_events","type":"User","site_admin":false},"created_at":"2018-08-13T04:46:29Z","updated_at":"2018-08-13T04:46:44Z","column_url":"https://api.github.com/projects/columns/3138831","content_url":"https://api.github.com/repos/bbi-yggy/PyGithub/issues/2"},{"url":"https://api.github.com/projects/columns/cards/12079385","id":12079385,"node_id":"MDExOlByb2plY3RDYXJkMTIwNzkzODU=","note":"Test note","archived":false,"creator":{"login":"bbi-yggy","id":6392037,"node_id":"MDQ6VXNlcjYzOTIwMzc=","avatar_url":"https://avatars3.githubusercontent.com/u/6392037?v=4","gravatar_id":"","url":"https://api.github.com/users/bbi-yggy","html_url":"https://github.com/bbi-yggy","followers_url":"https://api.github.com/users/bbi-yggy/followers","following_url":"https://api.github.com/users/bbi-yggy/following{/other_user}","gists_url":"https://api.github.com/users/bbi-yggy/gists{/gist_id}","starred_url":"https://api.github.com/users/bbi-yggy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbi-yggy/subscriptions","organizations_url":"https://api.github.com/users/bbi-yggy/orgs","repos_url":"https://api.github.com/users/bbi-yggy/repos","events_url":"https://api.github.com/users/bbi-yggy/events{/privacy}","received_events_url":"https://api.github.com/users/bbi-yggy/received_events","type":"User","site_admin":false},"created_at":"2018-08-13T05:36:13Z","updated_at":"2018-08-13T05:36:20Z","column_url":"https://api.github.com/projects/columns/3138831"}] + +https +GET +api.github.com +None +/repos/bbi-yggy/PyGithub/pulls/1 +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Date', 'Mon, 13 Aug 2018 20:46:32 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Server', 'GitHub.com'), ('Status', '200 OK'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4987'), ('X-RateLimit-Reset', '1534195928'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('ETag', 'W/"79ec8dc6d53d5a66da6dbafa9cbf0628"'), ('Last-Modified', 'Thu, 09 Aug 2018 05:13:27 GMT'), ('X-OAuth-Scopes', 'read:org, read:user, repo, user:email'), ('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'"), ('X-Runtime-rack', '0.263844'), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'EDDE:528C:C859D:1042C8:5B71EE28')] +{"url":"https://api.github.com/repos/bbi-yggy/PyGithub/pulls/1","id":205308656,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA1MzA4NjU2","html_url":"https://github.com/bbi-yggy/PyGithub/pull/1","diff_url":"https://github.com/bbi-yggy/PyGithub/pull/1.diff","patch_url":"https://github.com/bbi-yggy/PyGithub/pull/1.patch","issue_url":"https://api.github.com/repos/bbi-yggy/PyGithub/issues/1","number":1,"state":"closed","locked":false,"title":"Work in progress on support for GitHub projects API.","user":{"login":"bbi-yggy","id":6392037,"node_id":"MDQ6VXNlcjYzOTIwMzc=","avatar_url":"https://avatars3.githubusercontent.com/u/6392037?v=4","gravatar_id":"","url":"https://api.github.com/users/bbi-yggy","html_url":"https://github.com/bbi-yggy","followers_url":"https://api.github.com/users/bbi-yggy/followers","following_url":"https://api.github.com/users/bbi-yggy/following{/other_user}","gists_url":"https://api.github.com/users/bbi-yggy/gists{/gist_id}","starred_url":"https://api.github.com/users/bbi-yggy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbi-yggy/subscriptions","organizations_url":"https://api.github.com/users/bbi-yggy/orgs","repos_url":"https://api.github.com/users/bbi-yggy/repos","events_url":"https://api.github.com/users/bbi-yggy/events{/privacy}","received_events_url":"https://api.github.com/users/bbi-yggy/received_events","type":"User","site_admin":false},"body":"Pull request moved to https://github.com/PyGithub/PyGithub/pull/854","created_at":"2018-08-01T04:53:48Z","updated_at":"2018-08-09T05:13:27Z","closed_at":"2018-08-09T05:13:27Z","merged_at":null,"merge_commit_sha":"047ac715c32a08ab83e43809a43592933badccfe","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/bbi-yggy/PyGithub/pulls/1/commits","review_comments_url":"https://api.github.com/repos/bbi-yggy/PyGithub/pulls/1/comments","review_comment_url":"https://api.github.com/repos/bbi-yggy/PyGithub/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bbi-yggy/PyGithub/issues/1/comments","statuses_url":"https://api.github.com/repos/bbi-yggy/PyGithub/statuses/552d5213f9bd6ac3c51de782cbda72ef336a0ada","head":{"label":"bbi-yggy:dev.project-support","ref":"dev.project-support","sha":"552d5213f9bd6ac3c51de782cbda72ef336a0ada","user":{"login":"bbi-yggy","id":6392037,"node_id":"MDQ6VXNlcjYzOTIwMzc=","avatar_url":"https://avatars3.githubusercontent.com/u/6392037?v=4","gravatar_id":"","url":"https://api.github.com/users/bbi-yggy","html_url":"https://github.com/bbi-yggy","followers_url":"https://api.github.com/users/bbi-yggy/followers","following_url":"https://api.github.com/users/bbi-yggy/following{/other_user}","gists_url":"https://api.github.com/users/bbi-yggy/gists{/gist_id}","starred_url":"https://api.github.com/users/bbi-yggy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbi-yggy/subscriptions","organizations_url":"https://api.github.com/users/bbi-yggy/orgs","repos_url":"https://api.github.com/users/bbi-yggy/repos","events_url":"https://api.github.com/users/bbi-yggy/events{/privacy}","received_events_url":"https://api.github.com/users/bbi-yggy/received_events","type":"User","site_admin":false},"repo":{"id":143089995,"node_id":"MDEwOlJlcG9zaXRvcnkxNDMwODk5OTU=","name":"PyGithub","full_name":"bbi-yggy/PyGithub","owner":{"login":"bbi-yggy","id":6392037,"node_id":"MDQ6VXNlcjYzOTIwMzc=","avatar_url":"https://avatars3.githubusercontent.com/u/6392037?v=4","gravatar_id":"","url":"https://api.github.com/users/bbi-yggy","html_url":"https://github.com/bbi-yggy","followers_url":"https://api.github.com/users/bbi-yggy/followers","following_url":"https://api.github.com/users/bbi-yggy/following{/other_user}","gists_url":"https://api.github.com/users/bbi-yggy/gists{/gist_id}","starred_url":"https://api.github.com/users/bbi-yggy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbi-yggy/subscriptions","organizations_url":"https://api.github.com/users/bbi-yggy/orgs","repos_url":"https://api.github.com/users/bbi-yggy/repos","events_url":"https://api.github.com/users/bbi-yggy/events{/privacy}","received_events_url":"https://api.github.com/users/bbi-yggy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bbi-yggy/PyGithub","description":"Typed interactions with the GitHub API v3","fork":true,"url":"https://api.github.com/repos/bbi-yggy/PyGithub","forks_url":"https://api.github.com/repos/bbi-yggy/PyGithub/forks","keys_url":"https://api.github.com/repos/bbi-yggy/PyGithub/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bbi-yggy/PyGithub/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bbi-yggy/PyGithub/teams","hooks_url":"https://api.github.com/repos/bbi-yggy/PyGithub/hooks","issue_events_url":"https://api.github.com/repos/bbi-yggy/PyGithub/issues/events{/number}","events_url":"https://api.github.com/repos/bbi-yggy/PyGithub/events","assignees_url":"https://api.github.com/repos/bbi-yggy/PyGithub/assignees{/user}","branches_url":"https://api.github.com/repos/bbi-yggy/PyGithub/branches{/branch}","tags_url":"https://api.github.com/repos/bbi-yggy/PyGithub/tags","blobs_url":"https://api.github.com/repos/bbi-yggy/PyGithub/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bbi-yggy/PyGithub/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bbi-yggy/PyGithub/git/refs{/sha}","trees_url":"https://api.github.com/repos/bbi-yggy/PyGithub/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bbi-yggy/PyGithub/statuses/{sha}","languages_url":"https://api.github.com/repos/bbi-yggy/PyGithub/languages","stargazers_url":"https://api.github.com/repos/bbi-yggy/PyGithub/stargazers","contributors_url":"https://api.github.com/repos/bbi-yggy/PyGithub/contributors","subscribers_url":"https://api.github.com/repos/bbi-yggy/PyGithub/subscribers","subscription_url":"https://api.github.com/repos/bbi-yggy/PyGithub/subscription","commits_url":"https://api.github.com/repos/bbi-yggy/PyGithub/commits{/sha}","git_commits_url":"https://api.github.com/repos/bbi-yggy/PyGithub/git/commits{/sha}","comments_url":"https://api.github.com/repos/bbi-yggy/PyGithub/comments{/number}","issue_comment_url":"https://api.github.com/repos/bbi-yggy/PyGithub/issues/comments{/number}","contents_url":"https://api.github.com/repos/bbi-yggy/PyGithub/contents/{+path}","compare_url":"https://api.github.com/repos/bbi-yggy/PyGithub/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bbi-yggy/PyGithub/merges","archive_url":"https://api.github.com/repos/bbi-yggy/PyGithub/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bbi-yggy/PyGithub/downloads","issues_url":"https://api.github.com/repos/bbi-yggy/PyGithub/issues{/number}","pulls_url":"https://api.github.com/repos/bbi-yggy/PyGithub/pulls{/number}","milestones_url":"https://api.github.com/repos/bbi-yggy/PyGithub/milestones{/number}","notifications_url":"https://api.github.com/repos/bbi-yggy/PyGithub/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bbi-yggy/PyGithub/labels{/name}","releases_url":"https://api.github.com/repos/bbi-yggy/PyGithub/releases{/id}","deployments_url":"https://api.github.com/repos/bbi-yggy/PyGithub/deployments","created_at":"2018-08-01T01:50:10Z","updated_at":"2018-08-01T05:11:35Z","pushed_at":"2018-08-13T19:19:24Z","git_url":"git://github.com/bbi-yggy/PyGithub.git","ssh_url":"git@github.com:bbi-yggy/PyGithub.git","clone_url":"https://github.com/bbi-yggy/PyGithub.git","svn_url":"https://github.com/bbi-yggy/PyGithub","homepage":"http://pygithub.readthedocs.io/","size":11292,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"lgpl-3.0","name":"GNU Lesser General Public License v3.0","spdx_id":"LGPL-3.0","url":"https://api.github.com/licenses/lgpl-3.0","node_id":"MDc6TGljZW5zZTEy"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"bbi-yggy:master","ref":"master","sha":"29d231517dec44314e81c691d7c4e398380414b1","user":{"login":"bbi-yggy","id":6392037,"node_id":"MDQ6VXNlcjYzOTIwMzc=","avatar_url":"https://avatars3.githubusercontent.com/u/6392037?v=4","gravatar_id":"","url":"https://api.github.com/users/bbi-yggy","html_url":"https://github.com/bbi-yggy","followers_url":"https://api.github.com/users/bbi-yggy/followers","following_url":"https://api.github.com/users/bbi-yggy/following{/other_user}","gists_url":"https://api.github.com/users/bbi-yggy/gists{/gist_id}","starred_url":"https://api.github.com/users/bbi-yggy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbi-yggy/subscriptions","organizations_url":"https://api.github.com/users/bbi-yggy/orgs","repos_url":"https://api.github.com/users/bbi-yggy/repos","events_url":"https://api.github.com/users/bbi-yggy/events{/privacy}","received_events_url":"https://api.github.com/users/bbi-yggy/received_events","type":"User","site_admin":false},"repo":{"id":143089995,"node_id":"MDEwOlJlcG9zaXRvcnkxNDMwODk5OTU=","name":"PyGithub","full_name":"bbi-yggy/PyGithub","owner":{"login":"bbi-yggy","id":6392037,"node_id":"MDQ6VXNlcjYzOTIwMzc=","avatar_url":"https://avatars3.githubusercontent.com/u/6392037?v=4","gravatar_id":"","url":"https://api.github.com/users/bbi-yggy","html_url":"https://github.com/bbi-yggy","followers_url":"https://api.github.com/users/bbi-yggy/followers","following_url":"https://api.github.com/users/bbi-yggy/following{/other_user}","gists_url":"https://api.github.com/users/bbi-yggy/gists{/gist_id}","starred_url":"https://api.github.com/users/bbi-yggy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbi-yggy/subscriptions","organizations_url":"https://api.github.com/users/bbi-yggy/orgs","repos_url":"https://api.github.com/users/bbi-yggy/repos","events_url":"https://api.github.com/users/bbi-yggy/events{/privacy}","received_events_url":"https://api.github.com/users/bbi-yggy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bbi-yggy/PyGithub","description":"Typed interactions with the GitHub API v3","fork":true,"url":"https://api.github.com/repos/bbi-yggy/PyGithub","forks_url":"https://api.github.com/repos/bbi-yggy/PyGithub/forks","keys_url":"https://api.github.com/repos/bbi-yggy/PyGithub/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bbi-yggy/PyGithub/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bbi-yggy/PyGithub/teams","hooks_url":"https://api.github.com/repos/bbi-yggy/PyGithub/hooks","issue_events_url":"https://api.github.com/repos/bbi-yggy/PyGithub/issues/events{/number}","events_url":"https://api.github.com/repos/bbi-yggy/PyGithub/events","assignees_url":"https://api.github.com/repos/bbi-yggy/PyGithub/assignees{/user}","branches_url":"https://api.github.com/repos/bbi-yggy/PyGithub/branches{/branch}","tags_url":"https://api.github.com/repos/bbi-yggy/PyGithub/tags","blobs_url":"https://api.github.com/repos/bbi-yggy/PyGithub/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bbi-yggy/PyGithub/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bbi-yggy/PyGithub/git/refs{/sha}","trees_url":"https://api.github.com/repos/bbi-yggy/PyGithub/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bbi-yggy/PyGithub/statuses/{sha}","languages_url":"https://api.github.com/repos/bbi-yggy/PyGithub/languages","stargazers_url":"https://api.github.com/repos/bbi-yggy/PyGithub/stargazers","contributors_url":"https://api.github.com/repos/bbi-yggy/PyGithub/contributors","subscribers_url":"https://api.github.com/repos/bbi-yggy/PyGithub/subscribers","subscription_url":"https://api.github.com/repos/bbi-yggy/PyGithub/subscription","commits_url":"https://api.github.com/repos/bbi-yggy/PyGithub/commits{/sha}","git_commits_url":"https://api.github.com/repos/bbi-yggy/PyGithub/git/commits{/sha}","comments_url":"https://api.github.com/repos/bbi-yggy/PyGithub/comments{/number}","issue_comment_url":"https://api.github.com/repos/bbi-yggy/PyGithub/issues/comments{/number}","contents_url":"https://api.github.com/repos/bbi-yggy/PyGithub/contents/{+path}","compare_url":"https://api.github.com/repos/bbi-yggy/PyGithub/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bbi-yggy/PyGithub/merges","archive_url":"https://api.github.com/repos/bbi-yggy/PyGithub/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bbi-yggy/PyGithub/downloads","issues_url":"https://api.github.com/repos/bbi-yggy/PyGithub/issues{/number}","pulls_url":"https://api.github.com/repos/bbi-yggy/PyGithub/pulls{/number}","milestones_url":"https://api.github.com/repos/bbi-yggy/PyGithub/milestones{/number}","notifications_url":"https://api.github.com/repos/bbi-yggy/PyGithub/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bbi-yggy/PyGithub/labels{/name}","releases_url":"https://api.github.com/repos/bbi-yggy/PyGithub/releases{/id}","deployments_url":"https://api.github.com/repos/bbi-yggy/PyGithub/deployments","created_at":"2018-08-01T01:50:10Z","updated_at":"2018-08-01T05:11:35Z","pushed_at":"2018-08-13T19:19:24Z","git_url":"git://github.com/bbi-yggy/PyGithub.git","ssh_url":"git@github.com:bbi-yggy/PyGithub.git","clone_url":"https://github.com/bbi-yggy/PyGithub.git","svn_url":"https://github.com/bbi-yggy/PyGithub","homepage":"http://pygithub.readthedocs.io/","size":11292,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"lgpl-3.0","name":"GNU Lesser General Public License v3.0","spdx_id":"LGPL-3.0","url":"https://api.github.com/licenses/lgpl-3.0","node_id":"MDc6TGljZW5zZTEy"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bbi-yggy/PyGithub/pulls/1"},"html":{"href":"https://github.com/bbi-yggy/PyGithub/pull/1"},"issue":{"href":"https://api.github.com/repos/bbi-yggy/PyGithub/issues/1"},"comments":{"href":"https://api.github.com/repos/bbi-yggy/PyGithub/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/bbi-yggy/PyGithub/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/bbi-yggy/PyGithub/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bbi-yggy/PyGithub/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/bbi-yggy/PyGithub/statuses/552d5213f9bd6ac3c51de782cbda72ef336a0ada"}},"author_association":"OWNER","merged":false,"mergeable":true,"rebaseable":true,"mergeable_state":"blocked","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":false,"commits":9,"additions":570,"deletions":2,"changed_files":12} + +https +GET +api.github.com +None +/repos/bbi-yggy/PyGithub/issues/2 +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Date', 'Mon, 13 Aug 2018 20:46:32 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Server', 'GitHub.com'), ('Status', '200 OK'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4986'), ('X-RateLimit-Reset', '1534195928'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('ETag', 'W/"4539c5ec1d602de328c3b20478b62ed1"'), ('Last-Modified', 'Mon, 13 Aug 2018 04:46:29 GMT'), ('X-OAuth-Scopes', 'read:org, read:user, repo, user:email'), ('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'"), ('X-Runtime-rack', '0.052249'), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'EDE7:528C:C85BD:1042F1:5B71EE28')] +{"url":"https://api.github.com/repos/bbi-yggy/PyGithub/issues/2","repository_url":"https://api.github.com/repos/bbi-yggy/PyGithub","labels_url":"https://api.github.com/repos/bbi-yggy/PyGithub/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/bbi-yggy/PyGithub/issues/2/comments","events_url":"https://api.github.com/repos/bbi-yggy/PyGithub/issues/2/events","html_url":"https://github.com/bbi-yggy/PyGithub/issues/2","id":349886358,"node_id":"MDU6SXNzdWUzNDk4ODYzNTg=","number":2,"title":"Test issue","user":{"login":"bbi-yggy","id":6392037,"node_id":"MDQ6VXNlcjYzOTIwMzc=","avatar_url":"https://avatars3.githubusercontent.com/u/6392037?v=4","gravatar_id":"","url":"https://api.github.com/users/bbi-yggy","html_url":"https://github.com/bbi-yggy","followers_url":"https://api.github.com/users/bbi-yggy/followers","following_url":"https://api.github.com/users/bbi-yggy/following{/other_user}","gists_url":"https://api.github.com/users/bbi-yggy/gists{/gist_id}","starred_url":"https://api.github.com/users/bbi-yggy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbi-yggy/subscriptions","organizations_url":"https://api.github.com/users/bbi-yggy/orgs","repos_url":"https://api.github.com/users/bbi-yggy/repos","events_url":"https://api.github.com/users/bbi-yggy/events{/privacy}","received_events_url":"https://api.github.com/users/bbi-yggy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-13T04:46:29Z","updated_at":"2018-08-13T04:46:29Z","closed_at":null,"author_association":"OWNER","body":"To be added to Test Project as a card.","closed_by":null} + diff --git a/github/tests/ReplayData/Project.testGetRepositoryProjects.txt b/github/tests/ReplayData/Project.testGetRepositoryProjects.txt new file mode 100644 index 00000000..f14fb182 --- /dev/null +++ b/github/tests/ReplayData/Project.testGetRepositoryProjects.txt @@ -0,0 +1,11 @@ +https +GET +api.github.com +None +/repos/bbi-yggy/PyGithub/projects?state=all +{'Accept': 'application/vnd.github.inertia-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Server', 'GitHub.com'), ('Date', 'Sat, 11 Aug 2018 04:53:47 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Status', '200 OK'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4987'), ('X-RateLimit-Reset', '1533965918'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP'), ('ETag', 'W/"ba42e988ba2c8b55631630810faf2098"'), ('X-OAuth-Scopes', 'repo'), ('X-Accepted-OAuth-Scopes', 'public_repo, repo'), ('X-GitHub-Media-Type', 'github.inertia-preview; 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'"), ('X-Runtime-rack', '0.098354'), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'DB0A:5AC3:59436D:DE4A3B:5B6E6BDA')] +[{"owner_url":"https://api.github.com/repos/bbi-yggy/PyGithub","url":"https://api.github.com/projects/1682941","html_url":"https://github.com/bbi-yggy/PyGithub/projects/1","columns_url":"https://api.github.com/projects/1682941/columns","id":1682941,"node_id":"MDc6UHJvamVjdDE2ODI5NDE=","name":"TestProject","body":"To be used for testing project access API for PyGithub.","number":1,"state":"open","creator":{"login":"bbi-yggy","id":6392037,"node_id":"MDQ6VXNlcjYzOTIwMzc=","avatar_url":"https://avatars3.githubusercontent.com/u/6392037?v=4","gravatar_id":"","url":"https://api.github.com/users/bbi-yggy","html_url":"https://github.com/bbi-yggy","followers_url":"https://api.github.com/users/bbi-yggy/followers","following_url":"https://api.github.com/users/bbi-yggy/following{/other_user}","gists_url":"https://api.github.com/users/bbi-yggy/gists{/gist_id}","starred_url":"https://api.github.com/users/bbi-yggy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbi-yggy/subscriptions","organizations_url":"https://api.github.com/users/bbi-yggy/orgs","repos_url":"https://api.github.com/users/bbi-yggy/repos","events_url":"https://api.github.com/users/bbi-yggy/events{/privacy}","received_events_url":"https://api.github.com/users/bbi-yggy/received_events","type":"User","site_admin":false},"created_at":"2018-08-01T04:06:57Z","updated_at":"2018-08-03T00:31:17Z"},{"owner_url":"https://api.github.com/repos/bbi-yggy/PyGithub","url":"https://api.github.com/projects/1704764","html_url":"https://github.com/bbi-yggy/PyGithub/projects/2","columns_url":"https://api.github.com/projects/1704764/columns","id":1704764,"node_id":"MDc6UHJvamVjdDE3MDQ3NjQ=","name":"TestProjectClosed","body":"Test project in a closed state.","number":2,"state":"closed","creator":{"login":"bbi-yggy","id":6392037,"node_id":"MDQ6VXNlcjYzOTIwMzc=","avatar_url":"https://avatars3.githubusercontent.com/u/6392037?v=4","gravatar_id":"","url":"https://api.github.com/users/bbi-yggy","html_url":"https://github.com/bbi-yggy","followers_url":"https://api.github.com/users/bbi-yggy/followers","following_url":"https://api.github.com/users/bbi-yggy/following{/other_user}","gists_url":"https://api.github.com/users/bbi-yggy/gists{/gist_id}","starred_url":"https://api.github.com/users/bbi-yggy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbi-yggy/subscriptions","organizations_url":"https://api.github.com/users/bbi-yggy/orgs","repos_url":"https://api.github.com/users/bbi-yggy/repos","events_url":"https://api.github.com/users/bbi-yggy/events{/privacy}","received_events_url":"https://api.github.com/users/bbi-yggy/received_events","type":"User","site_admin":false},"created_at":"2018-08-11T04:48:14Z","updated_at":"2018-08-11T04:48:23Z"}] + diff --git a/github/tests/ReplayData/Project.testProjectAttributes.txt b/github/tests/ReplayData/Project.testProjectAttributes.txt new file mode 100644 index 00000000..05ff8f42 --- /dev/null +++ b/github/tests/ReplayData/Project.testProjectAttributes.txt @@ -0,0 +1,11 @@ +https +GET +api.github.com +None +/projects/1682941 +{'Accept': 'application/vnd.github.inertia-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Server', 'GitHub.com'), ('Date', 'Sat, 11 Aug 2018 05:25:10 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Status', '200 OK'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4971'), ('X-RateLimit-Reset', '1533965918'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP'), ('ETag', 'W/"27943de4706a46a49435f50612ed14a7"'), ('X-OAuth-Scopes', 'repo'), ('X-Accepted-OAuth-Scopes', 'public_repo, repo'), ('X-GitHub-Media-Type', 'github.inertia-preview; 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'"), ('X-Runtime-rack', '0.061095'), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'DB9E:5AC6:C62649:1C03B15:5B6E7336')] +{"owner_url":"https://api.github.com/repos/bbi-yggy/PyGithub","url":"https://api.github.com/projects/1682941","html_url":"https://github.com/bbi-yggy/PyGithub/projects/1","columns_url":"https://api.github.com/projects/1682941/columns","id":1682941,"node_id":"MDc6UHJvamVjdDE2ODI5NDE=","name":"TestProject","body":"To be used for testing project access API for PyGithub.","number":1,"state":"open","creator":{"login":"bbi-yggy","id":6392037,"node_id":"MDQ6VXNlcjYzOTIwMzc=","avatar_url":"https://avatars3.githubusercontent.com/u/6392037?v=4","gravatar_id":"","url":"https://api.github.com/users/bbi-yggy","html_url":"https://github.com/bbi-yggy","followers_url":"https://api.github.com/users/bbi-yggy/followers","following_url":"https://api.github.com/users/bbi-yggy/following{/other_user}","gists_url":"https://api.github.com/users/bbi-yggy/gists{/gist_id}","starred_url":"https://api.github.com/users/bbi-yggy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbi-yggy/subscriptions","organizations_url":"https://api.github.com/users/bbi-yggy/orgs","repos_url":"https://api.github.com/users/bbi-yggy/repos","events_url":"https://api.github.com/users/bbi-yggy/events{/privacy}","received_events_url":"https://api.github.com/users/bbi-yggy/received_events","type":"User","site_admin":false},"created_at":"2018-08-01T04:06:57Z","updated_at":"2018-08-03T00:31:17Z"} + diff --git a/github/tests/ReplayData/Project.testProjectCardAttributes.txt b/github/tests/ReplayData/Project.testProjectCardAttributes.txt new file mode 100644 index 00000000..339cbdb4 --- /dev/null +++ b/github/tests/ReplayData/Project.testProjectCardAttributes.txt @@ -0,0 +1,33 @@ +https +GET +api.github.com +None +/projects/1682941 +{'Accept': 'application/vnd.github.inertia-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Server', 'GitHub.com'), ('Date', 'Mon, 13 Aug 2018 04:43:42 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Status', '200 OK'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4962'), ('X-RateLimit-Reset', '1534137668'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP'), ('ETag', 'W/"27943de4706a46a49435f50612ed14a7"'), ('X-OAuth-Scopes', 'repo'), ('X-Accepted-OAuth-Scopes', 'public_repo, repo'), ('X-GitHub-Media-Type', 'github.inertia-preview; 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'"), ('X-Runtime-rack', '0.049242'), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'DEA1:5F7A:481C7:8BD49:5B710C7E')] +{"owner_url":"https://api.github.com/repos/bbi-yggy/PyGithub","url":"https://api.github.com/projects/1682941","html_url":"https://github.com/bbi-yggy/PyGithub/projects/1","columns_url":"https://api.github.com/projects/1682941/columns","id":1682941,"node_id":"MDc6UHJvamVjdDE2ODI5NDE=","name":"TestProject","body":"To be used for testing project access API for PyGithub.","number":1,"state":"open","creator":{"login":"bbi-yggy","id":6392037,"node_id":"MDQ6VXNlcjYzOTIwMzc=","avatar_url":"https://avatars3.githubusercontent.com/u/6392037?v=4","gravatar_id":"","url":"https://api.github.com/users/bbi-yggy","html_url":"https://github.com/bbi-yggy","followers_url":"https://api.github.com/users/bbi-yggy/followers","following_url":"https://api.github.com/users/bbi-yggy/following{/other_user}","gists_url":"https://api.github.com/users/bbi-yggy/gists{/gist_id}","starred_url":"https://api.github.com/users/bbi-yggy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbi-yggy/subscriptions","organizations_url":"https://api.github.com/users/bbi-yggy/orgs","repos_url":"https://api.github.com/users/bbi-yggy/repos","events_url":"https://api.github.com/users/bbi-yggy/events{/privacy}","received_events_url":"https://api.github.com/users/bbi-yggy/received_events","type":"User","site_admin":false},"created_at":"2018-08-01T04:06:57Z","updated_at":"2018-08-03T00:31:17Z"} + +https +GET +api.github.com +None +/projects/1682941/columns +{'Accept': 'application/vnd.github.inertia-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Server', 'GitHub.com'), ('Date', 'Mon, 13 Aug 2018 04:43:42 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Status', '200 OK'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4961'), ('X-RateLimit-Reset', '1534137668'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP'), ('ETag', 'W/"3163aa25d9bf114a91b6ac971fec44f1"'), ('X-OAuth-Scopes', 'repo'), ('X-Accepted-OAuth-Scopes', 'public_repo, repo'), ('X-GitHub-Media-Type', 'github.inertia-preview; 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'"), ('X-Runtime-rack', '0.064389'), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'DEA2:5F7A:481E2:8BD71:5B710C7E')] +[{"url":"https://api.github.com/projects/columns/3138830","project_url":"https://api.github.com/projects/1682941","cards_url":"https://api.github.com/projects/columns/3138830/cards","id":3138830,"node_id":"MDEzOlByb2plY3RDb2x1bW4zMTM4ODMw","name":"To Do","created_at":"2018-08-01T04:07:35Z","updated_at":"2018-08-01T04:07:35Z"},{"url":"https://api.github.com/projects/columns/3138831","project_url":"https://api.github.com/projects/1682941","cards_url":"https://api.github.com/projects/columns/3138831/cards","id":3138831,"node_id":"MDEzOlByb2plY3RDb2x1bW4zMTM4ODMx","name":"In Progress","created_at":"2018-08-01T04:07:43Z","updated_at":"2018-08-01T04:54:16Z"},{"url":"https://api.github.com/projects/columns/3138832","project_url":"https://api.github.com/projects/1682941","cards_url":"https://api.github.com/projects/columns/3138832/cards","id":3138832,"node_id":"MDEzOlByb2plY3RDb2x1bW4zMTM4ODMy","name":"Done","created_at":"2018-08-01T04:07:47Z","updated_at":"2018-08-03T00:31:17Z"}] + +https +GET +api.github.com +None +/projects/columns/3138831/cards +{'Accept': 'application/vnd.github.inertia-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Server', 'GitHub.com'), ('Date', 'Mon, 13 Aug 2018 04:43:43 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Status', '200 OK'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4960'), ('X-RateLimit-Reset', '1534137668'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP'), ('ETag', 'W/"10383f6a2c126768bba0316a3547d35c"'), ('X-OAuth-Scopes', 'repo'), ('X-Accepted-OAuth-Scopes', 'public_repo, repo'), ('X-GitHub-Media-Type', 'github.inertia-preview; 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'"), ('X-Runtime-rack', '0.106876'), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'DEA3:5F78:2ECFD:71104:5B710C7E')] +[{"url":"https://api.github.com/projects/columns/cards/11780055","id":11780055,"node_id":"MDExOlByb2plY3RDYXJkMTE3ODAwNTU=","note":null,"archived":false,"creator":{"login":"bbi-yggy","id":6392037,"node_id":"MDQ6VXNlcjYzOTIwMzc=","avatar_url":"https://avatars3.githubusercontent.com/u/6392037?v=4","gravatar_id":"","url":"https://api.github.com/users/bbi-yggy","html_url":"https://github.com/bbi-yggy","followers_url":"https://api.github.com/users/bbi-yggy/followers","following_url":"https://api.github.com/users/bbi-yggy/following{/other_user}","gists_url":"https://api.github.com/users/bbi-yggy/gists{/gist_id}","starred_url":"https://api.github.com/users/bbi-yggy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbi-yggy/subscriptions","organizations_url":"https://api.github.com/users/bbi-yggy/orgs","repos_url":"https://api.github.com/users/bbi-yggy/repos","events_url":"https://api.github.com/users/bbi-yggy/events{/privacy}","received_events_url":"https://api.github.com/users/bbi-yggy/received_events","type":"User","site_admin":false},"created_at":"2018-08-01T04:53:59Z","updated_at":"2018-08-01T04:54:16Z","column_url":"https://api.github.com/projects/columns/3138831","content_url":"https://api.github.com/repos/bbi-yggy/PyGithub/issues/1"}] + diff --git a/github/tests/ReplayData/Project.testProjectColumnAttributes.txt b/github/tests/ReplayData/Project.testProjectColumnAttributes.txt new file mode 100644 index 00000000..063d2f30 --- /dev/null +++ b/github/tests/ReplayData/Project.testProjectColumnAttributes.txt @@ -0,0 +1,22 @@ +https +GET +api.github.com +None +/projects/1682941 +{'Accept': 'application/vnd.github.inertia-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Server', 'GitHub.com'), ('Date', 'Mon, 13 Aug 2018 04:27:29 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Status', '200 OK'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4986'), ('X-RateLimit-Reset', '1534137668'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP'), ('ETag', 'W/"27943de4706a46a49435f50612ed14a7"'), ('X-OAuth-Scopes', 'repo'), ('X-Accepted-OAuth-Scopes', 'public_repo, repo'), ('X-GitHub-Media-Type', 'github.inertia-preview; 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'"), ('X-Runtime-rack', '0.064815'), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'DE4E:5F76:13E6C:35FA4:5B7108B1')] +{"owner_url":"https://api.github.com/repos/bbi-yggy/PyGithub","url":"https://api.github.com/projects/1682941","html_url":"https://github.com/bbi-yggy/PyGithub/projects/1","columns_url":"https://api.github.com/projects/1682941/columns","id":1682941,"node_id":"MDc6UHJvamVjdDE2ODI5NDE=","name":"TestProject","body":"To be used for testing project access API for PyGithub.","number":1,"state":"open","creator":{"login":"bbi-yggy","id":6392037,"node_id":"MDQ6VXNlcjYzOTIwMzc=","avatar_url":"https://avatars3.githubusercontent.com/u/6392037?v=4","gravatar_id":"","url":"https://api.github.com/users/bbi-yggy","html_url":"https://github.com/bbi-yggy","followers_url":"https://api.github.com/users/bbi-yggy/followers","following_url":"https://api.github.com/users/bbi-yggy/following{/other_user}","gists_url":"https://api.github.com/users/bbi-yggy/gists{/gist_id}","starred_url":"https://api.github.com/users/bbi-yggy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbi-yggy/subscriptions","organizations_url":"https://api.github.com/users/bbi-yggy/orgs","repos_url":"https://api.github.com/users/bbi-yggy/repos","events_url":"https://api.github.com/users/bbi-yggy/events{/privacy}","received_events_url":"https://api.github.com/users/bbi-yggy/received_events","type":"User","site_admin":false},"created_at":"2018-08-01T04:06:57Z","updated_at":"2018-08-03T00:31:17Z"} + +https +GET +api.github.com +None +/projects/1682941/columns +{'Accept': 'application/vnd.github.inertia-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Server', 'GitHub.com'), ('Date', 'Mon, 13 Aug 2018 04:27:30 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Status', '200 OK'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4985'), ('X-RateLimit-Reset', '1534137668'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP'), ('ETag', 'W/"3163aa25d9bf114a91b6ac971fec44f1"'), ('X-OAuth-Scopes', 'repo'), ('X-Accepted-OAuth-Scopes', 'public_repo, repo'), ('X-GitHub-Media-Type', 'github.inertia-preview; 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'"), ('X-Runtime-rack', '0.053606'), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'DE4F:5F76:13E71:35FB1:5B7108B1')] +[{"url":"https://api.github.com/projects/columns/3138830","project_url":"https://api.github.com/projects/1682941","cards_url":"https://api.github.com/projects/columns/3138830/cards","id":3138830,"node_id":"MDEzOlByb2plY3RDb2x1bW4zMTM4ODMw","name":"To Do","created_at":"2018-08-01T04:07:35Z","updated_at":"2018-08-01T04:07:35Z"},{"url":"https://api.github.com/projects/columns/3138831","project_url":"https://api.github.com/projects/1682941","cards_url":"https://api.github.com/projects/columns/3138831/cards","id":3138831,"node_id":"MDEzOlByb2plY3RDb2x1bW4zMTM4ODMx","name":"In Progress","created_at":"2018-08-01T04:07:43Z","updated_at":"2018-08-01T04:54:16Z"},{"url":"https://api.github.com/projects/columns/3138832","project_url":"https://api.github.com/projects/1682941","cards_url":"https://api.github.com/projects/columns/3138832/cards","id":3138832,"node_id":"MDEzOlByb2plY3RDb2x1bW4zMTM4ODMy","name":"Done","created_at":"2018-08-01T04:07:47Z","updated_at":"2018-08-03T00:31:17Z"}] + diff --git a/scripts/add_attribute.py b/scripts/add_attribute.py index e686639b..52332b4c 100644 --- a/scripts/add_attribute.py +++ b/scripts/add_attribute.py @@ -8,6 +8,7 @@ # Copyright 2014 Vincent Jacques # # Copyright 2016 Peter Buckley # # Copyright 2018 sfdye # +# Copyright 2018 bbi-yggy # # # # This file is part of PyGithub. # # http://pygithub.readthedocs.io/ # @@ -30,18 +31,19 @@ import sys import os.path -# This script is unable to add an attribute after all the existing ones -# but, well, I'll do it manually in that case. - -className, attributeName, attributeType = sys.argv[1:] +className, attributeName, attributeType = sys.argv[1:4] +if len(sys.argv) > 4: + attributeClassType = sys.argv[4] +else: + attributeClassType = "" types = { - "string": ("string", "(str, unicode)", "attributes[\"" + attributeName + "\"]"), - "int": ("integer", "(int, long)", "attributes[\"" + attributeName + "\"]"), - "bool": ("bool", "bool", "attributes[\"" + attributeName + "\"]"), - "float": ("float", "float", "attributes[\"" + attributeName + "\"]"), - "datetime": ("datetime.datetime", "(str, unicode)", "self._parseDatetime(attributes[\"" + attributeName + "\"])"), + "string": ("string", None, "self._makeStringAttribute(attributes[\"" + attributeName + "\"])"), + "int": ("integer", None, "self._makeIntAttribute(attributes[\"" + attributeName + "\"])"), + "bool": ("bool", None, "self._makeBoolAttribute(attributes[\"" + attributeName + "\"])"), + "datetime": ("datetime.datetime", "(str, unicode)", "self._makeDatetimeAttribute(attributes[\"" + attributeName + "\"])"), + "class": (":class:`" + attributeClassType + "`", None, "self._makeClassAttribute(" + attributeClassType + ", attributes[\"" + attributeName + "\"])"), } attributeDocType, attributeAssertType, attributeValue = types[attributeType] @@ -58,25 +60,33 @@ i = 0 added = False +isCompletable = True isProperty = False while not added: line = lines[i].rstrip() i += 1 - if line == " @property": + if line.startswith("class "): + if "NonCompletableGithubObject" in line: + isCompletable = False + elif line == " @property": isProperty = True - if line.startswith(" def "): - if isProperty: - attrName = line[8:-7] - if attrName == "_identity" or attrName > attributeName: - newLines.append(" def " + attributeName + "(self):") - newLines.append(" \"\"\"") - newLines.append(" :type: " + attributeDocType) - newLines.append(" \"\"\"") - newLines.append(" self._completeIfNotSet(self._" + attributeName + ")") - newLines.append(" return self._NoneIfNotSet(self._" + attributeName + ")") - newLines.append("") + elif line.startswith(" def "): + attrName = line[8:-7] + # Properties will be inserted after __repr__, but before any other function. + if attrName != "__repr__" and (attrName == "_identity" or attrName > attributeName or not isProperty): + if not isProperty: newLines.append(" @property") - added = True + newLines.append(" def " + attributeName + "(self):") + newLines.append(" \"\"\"") + newLines.append(" :type: " + attributeDocType) + newLines.append(" \"\"\"") + if isCompletable: + newLines.append(" self._completeIfNotSet(self._" + attributeName + ")") + newLines.append(" return self._" + attributeName + ".value") + newLines.append("") + if isProperty: + newLines.append(" @property") + added = True isProperty = False newLines.append(line) @@ -101,7 +111,10 @@ added = False inUse = False while not added: - line = lines[i].rstrip() + try: + line = lines[i].rstrip() + except IndexError: + line = "" i += 1 if line == " def _useAttributes(self, attributes):": inUse = True @@ -111,7 +124,8 @@ while not added: attrName = line[12:-36] if not line or attrName > attributeName: newLines.append(" if \"" + attributeName + "\" in attributes: # pragma no branch") - newLines.append(" assert attributes[\"" + attributeName + "\"] is None or isinstance(attributes[\"" + attributeName + "\"], " + attributeAssertType + "), attributes[\"" + attributeName + "\"]") + if attributeAssertType: + newLines.append(" assert attributes[\"" + attributeName + "\"] is None or isinstance(attributes[\"" + attributeName + "\"], " + attributeAssertType + "), attributes[\"" + attributeName + "\"]") newLines.append(" self._" + attributeName + " = " + attributeValue) added = True newLines.append(line)