diff --git a/github/AuthenticatedUser.py b/github/AuthenticatedUser.py index 79d02cdf2c..5fd5652331 100644 --- a/github/AuthenticatedUser.py +++ b/github/AuthenticatedUser.py @@ -456,18 +456,12 @@ def create_authorization( isinstance(element, str) for element in scopes ), scopes assert note is github.GithubObject.NotSet or isinstance(note, str), note - assert note_url is github.GithubObject.NotSet or isinstance( - note_url, str - ), note_url - assert client_id is github.GithubObject.NotSet or isinstance( - client_id, str - ), client_id + assert note_url is github.GithubObject.NotSet or isinstance(note_url, str), note_url + assert client_id is github.GithubObject.NotSet or isinstance(client_id, str), client_id assert client_secret is github.GithubObject.NotSet or isinstance( client_secret, str ), client_secret - assert onetime_password is None or isinstance( - onetime_password, str - ), onetime_password + assert onetime_password is None or isinstance(onetime_password, str), onetime_password post_parameters = dict() if scopes is not github.GithubObject.NotSet: post_parameters["scopes"] = scopes @@ -491,9 +485,7 @@ def create_authorization( input=post_parameters, headers=request_header, ) - return github.Authorization.Authorization( - self._requester, headers, data, completed=True - ) + return github.Authorization.Authorization(self._requester, headers, data, completed=True) def create_fork(self, repo): """ @@ -505,9 +497,44 @@ def create_fork(self, repo): headers, data = self._requester.requestJsonAndCheck( "POST", f"/repos/{repo.owner.login}/{repo.name}/forks" ) - return github.Repository.Repository( - self._requester, headers, data, completed=True + return github.Repository.Repository(self._requester, headers, data, completed=True) + + def create_repo_from_template( + self, + name, + repo, + description=github.GithubObject.NotSet, + private=github.GithubObject.NotSet, + ): + """ + :calls: `POST /repos/:template_owner/:template_repo/generate ` + :param name: string + :param repo :class:`github.Repository.Repository` + :param description: string + :param private: bool + :rtype: :class:`github.Repository.Repository` + """ + assert isinstance(name, str), name + assert isinstance(repo, github.Repository.Repository), repo + assert description is github.GithubObject.NotSet or isinstance( + description, str + ), description + assert private is github.GithubObject.NotSet or isinstance(private, bool), private + post_parameters = { + "name": name, + "owner": self.login, + } + if description is not github.GithubObject.NotSet: + post_parameters["description"] = description + if private is not github.GithubObject.NotSet: + post_parameters["private"] = private + headers, data = self._requester.requestJsonAndCheck( + "POST", + f"/repos/{repo.owner.login}/{repo.name}/generate", + input=post_parameters, + headers={"Accept": Consts.mediaTypeTemplatesPreview}, ) + return github.Repository.Repository(self._requester, headers, data, completed=True) def create_gist(self, public, files, description=github.GithubObject.NotSet): """ @@ -530,9 +557,7 @@ def create_gist(self, public, files, description=github.GithubObject.NotSet): } if description is not github.GithubObject.NotSet: post_parameters["description"] = description - headers, data = self._requester.requestJsonAndCheck( - "POST", "/gists", input=post_parameters - ) + headers, data = self._requester.requestJsonAndCheck("POST", "/gists", input=post_parameters) return github.Gist.Gist(self._requester, headers, data, completed=True) def create_key(self, title, key): @@ -615,27 +640,17 @@ def create_repo( assert description is github.GithubObject.NotSet or isinstance( description, str ), description - assert homepage is github.GithubObject.NotSet or isinstance( - homepage, str - ), homepage - assert private is github.GithubObject.NotSet or isinstance( - private, bool - ), private - assert has_issues is github.GithubObject.NotSet or isinstance( - has_issues, bool - ), has_issues - assert has_wiki is github.GithubObject.NotSet or isinstance( - has_wiki, bool - ), has_wiki + assert homepage is github.GithubObject.NotSet or isinstance(homepage, str), homepage + assert private is github.GithubObject.NotSet or isinstance(private, bool), private + assert has_issues is github.GithubObject.NotSet or isinstance(has_issues, bool), has_issues + assert has_wiki is github.GithubObject.NotSet or isinstance(has_wiki, bool), has_wiki assert has_downloads is github.GithubObject.NotSet or isinstance( has_downloads, bool ), has_downloads assert has_projects is github.GithubObject.NotSet or isinstance( has_projects, bool ), has_projects - assert auto_init is github.GithubObject.NotSet or isinstance( - auto_init, bool - ), auto_init + assert auto_init is github.GithubObject.NotSet or isinstance(auto_init, bool), auto_init assert license_template is github.GithubObject.NotSet or isinstance( license_template, str ), license_template @@ -688,9 +703,7 @@ def create_repo( headers, data = self._requester.requestJsonAndCheck( "POST", "/user/repos", input=post_parameters ) - return github.Repository.Repository( - self._requester, headers, data, completed=True - ) + return github.Repository.Repository(self._requester, headers, data, completed=True) def edit( self, @@ -716,15 +729,9 @@ def edit( assert name is github.GithubObject.NotSet or isinstance(name, str), name assert email is github.GithubObject.NotSet or isinstance(email, str), email assert blog is github.GithubObject.NotSet or isinstance(blog, str), blog - assert company is github.GithubObject.NotSet or isinstance( - company, str - ), company - assert location is github.GithubObject.NotSet or isinstance( - location, str - ), location - assert hireable is github.GithubObject.NotSet or isinstance( - hireable, bool - ), hireable + assert company is github.GithubObject.NotSet or isinstance(company, str), company + assert location is github.GithubObject.NotSet or isinstance(location, str), location + assert hireable is github.GithubObject.NotSet or isinstance(hireable, bool), hireable assert bio is github.GithubObject.NotSet or isinstance(bio, str), bio post_parameters = dict() if name is not github.GithubObject.NotSet: @@ -741,9 +748,7 @@ def edit( post_parameters["hireable"] = hireable if bio is not github.GithubObject.NotSet: post_parameters["bio"] = bio - headers, data = self._requester.requestJsonAndCheck( - "PATCH", "/user", input=post_parameters - ) + headers, data = self._requester.requestJsonAndCheck("PATCH", "/user", input=post_parameters) self._useAttributes(data) def get_authorization(self, id): @@ -753,12 +758,8 @@ def get_authorization(self, id): :rtype: :class:`github.Authorization.Authorization` """ assert isinstance(id, int), id - headers, data = self._requester.requestJsonAndCheck( - "GET", f"/authorizations/{id}" - ) - return github.Authorization.Authorization( - self._requester, headers, data, completed=True - ) + headers, data = self._requester.requestJsonAndCheck("GET", f"/authorizations/{id}") + return github.Authorization.Authorization(self._requester, headers, data, completed=True) def get_authorizations(self): """ @@ -811,9 +812,7 @@ def get_gists(self, since=github.GithubObject.NotSet): :param since: datetime.datetime format YYYY-MM-DDTHH:MM:SSZ :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Gist.Gist` """ - assert since is github.GithubObject.NotSet or isinstance( - since, datetime.datetime - ), since + assert since is github.GithubObject.NotSet or isinstance(since, datetime.datetime), since url_parameters = dict() if since is not github.GithubObject.NotSet: url_parameters["since"] = since.strftime("%Y-%m-%dT%H:%M:%SZ") @@ -847,12 +846,8 @@ def get_issues( isinstance(element, github.Label.Label) for element in labels ), labels assert sort is github.GithubObject.NotSet or isinstance(sort, str), sort - assert direction is github.GithubObject.NotSet or isinstance( - direction, str - ), direction - assert since is github.GithubObject.NotSet or isinstance( - since, datetime.datetime - ), since + assert direction is github.GithubObject.NotSet or isinstance(direction, str), direction + assert since is github.GithubObject.NotSet or isinstance(since, datetime.datetime), since url_parameters = dict() if filter is not github.GithubObject.NotSet: url_parameters["filter"] = filter @@ -896,12 +891,8 @@ def get_user_issues( isinstance(element, github.Label.Label) for element in labels ), labels assert sort is github.GithubObject.NotSet or isinstance(sort, str), sort - assert direction is github.GithubObject.NotSet or isinstance( - direction, str - ), direction - assert since is github.GithubObject.NotSet or isinstance( - since, datetime.datetime - ), since + assert direction is github.GithubObject.NotSet or isinstance(direction, str), direction + assert since is github.GithubObject.NotSet or isinstance(since, datetime.datetime), since url_parameters = dict() if filter is not github.GithubObject.NotSet: url_parameters["filter"] = filter @@ -945,12 +936,8 @@ def get_notification(self, id): """ assert isinstance(id, str), id - headers, data = self._requester.requestJsonAndCheck( - "GET", f"/notifications/threads/{id}" - ) - return github.Notification.Notification( - self._requester, headers, data, completed=True - ) + headers, data = self._requester.requestJsonAndCheck("GET", f"/notifications/threads/{id}") + return github.Notification.Notification(self._requester, headers, data, completed=True) def get_notifications( self, @@ -972,12 +959,8 @@ def get_notifications( assert participating is github.GithubObject.NotSet or isinstance( participating, bool ), participating - assert since is github.GithubObject.NotSet or isinstance( - since, datetime.datetime - ), since - assert before is github.GithubObject.NotSet or isinstance( - before, datetime.datetime - ), before + assert since is github.GithubObject.NotSet or isinstance(since, datetime.datetime), since + assert before is github.GithubObject.NotSet or isinstance(before, datetime.datetime), before params = dict() if all is not github.GithubObject.NotSet: @@ -1025,12 +1008,8 @@ def get_repo(self, name): :rtype: :class:`github.Repository.Repository` """ assert isinstance(name, str), name - headers, data = self._requester.requestJsonAndCheck( - "GET", f"/repos/{self.login}/{name}" - ) - return github.Repository.Repository( - self._requester, headers, data, completed=True - ) + headers, data = self._requester.requestJsonAndCheck("GET", f"/repos/{self.login}/{name}") + return github.Repository.Repository(self._requester, headers, data, completed=True) def get_repos( self, @@ -1049,17 +1028,13 @@ def get_repos( :param direction: string :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository` """ - assert visibility is github.GithubObject.NotSet or isinstance( - visibility, str - ), visibility + assert visibility is github.GithubObject.NotSet or isinstance(visibility, str), visibility assert affiliation is github.GithubObject.NotSet or isinstance( affiliation, str ), affiliation assert type is github.GithubObject.NotSet or isinstance(type, str), type assert sort is github.GithubObject.NotSet or isinstance(sort, str), sort - assert direction is github.GithubObject.NotSet or isinstance( - direction, str - ), direction + assert direction is github.GithubObject.NotSet or isinstance(direction, str), direction url_parameters = dict() if visibility is not github.GithubObject.NotSet: url_parameters["visibility"] = visibility @@ -1256,9 +1231,7 @@ def accept_invitation(self, invitation): :param invitation: :class:`github.Invitation.Invitation` or int :rtype: None """ - assert isinstance(invitation, github.Invitation.Invitation) or isinstance( - invitation, int - ) + assert isinstance(invitation, github.Invitation.Invitation) or isinstance(invitation, int) if isinstance(invitation, github.Invitation.Invitation): invitation = invitation.id @@ -1311,9 +1284,7 @@ def create_migration( input=post_parameters, headers={"Accept": Consts.mediaTypeMigrationPreview}, ) - return github.Migration.Migration( - self._requester, headers, data, completed=True - ) + return github.Migration.Migration(self._requester, headers, data, completed=True) def get_migrations(self): """ @@ -1334,12 +1305,8 @@ def get_organization_membership(self, org): :rtype: :class:`github.Membership.Membership` """ assert isinstance(org, str) - headers, data = self._requester.requestJsonAndCheck( - "GET", f"/user/memberships/orgs/{org}" - ) - return github.Membership.Membership( - self._requester, headers, data, completed=True - ) + headers, data = self._requester.requestJsonAndCheck("GET", f"/user/memberships/orgs/{org}") + return github.Membership.Membership(self._requester, headers, data, completed=True) def _initAttributes(self): self._avatar_url = github.GithubObject.NotSet @@ -1427,13 +1394,9 @@ def _useAttributes(self, attributes): if "node_id" in attributes: # pragma no branch self._node_id = self._makeStringAttribute(attributes["node_id"]) if "organizations_url" in attributes: # pragma no branch - self._organizations_url = self._makeStringAttribute( - attributes["organizations_url"] - ) + self._organizations_url = self._makeStringAttribute(attributes["organizations_url"]) if "owned_private_repos" in attributes: # pragma no branch - self._owned_private_repos = self._makeIntAttribute( - attributes["owned_private_repos"] - ) + self._owned_private_repos = self._makeIntAttribute(attributes["owned_private_repos"]) if "plan" in attributes: # pragma no branch self._plan = self._makeClassAttribute(github.Plan.Plan, attributes["plan"]) if "private_gists" in attributes: # pragma no branch @@ -1443,9 +1406,7 @@ def _useAttributes(self, attributes): if "public_repos" in attributes: # pragma no branch self._public_repos = self._makeIntAttribute(attributes["public_repos"]) if "received_events_url" in attributes: # pragma no branch - self._received_events_url = self._makeStringAttribute( - attributes["received_events_url"] - ) + self._received_events_url = self._makeStringAttribute(attributes["received_events_url"]) if "repos_url" in attributes: # pragma no branch self._repos_url = self._makeStringAttribute(attributes["repos_url"]) if "site_admin" in attributes: # pragma no branch @@ -1453,13 +1414,9 @@ def _useAttributes(self, attributes): if "starred_url" in attributes: # pragma no branch self._starred_url = self._makeStringAttribute(attributes["starred_url"]) if "subscriptions_url" in attributes: # pragma no branch - self._subscriptions_url = self._makeStringAttribute( - attributes["subscriptions_url"] - ) + self._subscriptions_url = self._makeStringAttribute(attributes["subscriptions_url"]) if "total_private_repos" in attributes: # pragma no branch - self._total_private_repos = self._makeIntAttribute( - attributes["total_private_repos"] - ) + self._total_private_repos = self._makeIntAttribute(attributes["total_private_repos"]) if "type" in attributes: # pragma no branch self._type = self._makeStringAttribute(attributes["type"]) if "updated_at" in attributes: # pragma no branch diff --git a/github/Consts.py b/github/Consts.py index ec2ae6bf98..3d83cc8f3b 100644 --- a/github/Consts.py +++ b/github/Consts.py @@ -99,7 +99,10 @@ # https://developer.github.com/changes/2018-05-24-user-migration-api/ mediaTypeMigrationPreview = "application/vnd.github.wyandotte-preview+json" -# https://docs.github.com/en/rest/reference/search#highlighting-code-search-results-1 +# https://developer.github.com/changes/2019-07-16-repository-templates-api/ +mediaTypeTemplatesPreview = "application/vnd.github.baptiste-preview+json" + +# https://developer.github.com/v3/search/#highlighting-code-search-results-1 highLightSearchPreview = "application/vnd.github.v3.text-match+json" # https://developer.github.com/changes/2018-02-22-protected-branches-required-signatures/ diff --git a/github/Organization.py b/github/Organization.py index e71d249d7d..ffd704a53c 100644 --- a/github/Organization.py +++ b/github/Organization.py @@ -403,6 +403,47 @@ def create_fork(self, repo): self._requester, headers, data, completed=True ) + def create_repo_from_template( + self, + name, + repo, + description=github.GithubObject.NotSet, + private=github.GithubObject.NotSet, + ): + """self.name + :calls: `POST /repos/:template_owner/:template_repo/generate `_ + :param name: string + :param repo :class:`github.Repository.Repository` + :param description: string + :param private: bool + :rtype: :class:`github.Repository.Repository` + """ + assert isinstance(name, str), name + assert isinstance(repo, github.Repository.Repository), repo + assert description is github.GithubObject.NotSet or isinstance( + description, str + ), description + assert private is github.GithubObject.NotSet or isinstance( + private, bool + ), private + post_parameters = { + "name": name, + "owner": self.login, + } + if description is not github.GithubObject.NotSet: + post_parameters["description"] = description + if private is not github.GithubObject.NotSet: + post_parameters["private"] = private + headers, data = self._requester.requestJsonAndCheck( + "POST", + "/repos/" + repo.owner.login + "/" + repo.name + "/generate", + input=post_parameters, + headers={"Accept": Consts.mediaTypeTemplatesPreview}, + ) + return github.Repository.Repository( + self._requester, headers, data, completed=True + ) + def create_hook( self, name, diff --git a/github/Repository.py b/github/Repository.py index 51a84fc4ad..f1af79073e 100644 --- a/github/Repository.py +++ b/github/Repository.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + ############################ Copyrights and license ############################ # # # Copyright 2012 Christopher Gilbert # @@ -64,7 +66,6 @@ # Copyright 2018 Zilei Gu # # Copyright 2018 Yves Zumbach # # Copyright 2018 Leying Chen # -# Copyright 2020 Pascal Hofmann # # # # This file is part of PyGithub. # # http://pygithub.readthedocs.io/ # @@ -92,14 +93,11 @@ from deprecated import deprecated import github.Branch -import github.CheckRun -import github.CheckSuite import github.Clones import github.Commit import github.CommitComment import github.Comparison import github.ContentFile -import github.Deployment import github.Download import github.Event import github.GitBlob @@ -122,13 +120,10 @@ import github.Path import github.Permissions import github.Project -import github.PublicKey import github.PullRequest import github.Referrer import github.Repository import github.RepositoryKey -import github.RepositoryPreferences -import github.SelfHostedActionsRunner import github.SourceImport import github.Stargazer import github.StatsCodeFrequency @@ -139,8 +134,6 @@ import github.Tag import github.Team import github.View -import github.Workflow -import github.WorkflowRun from . import Consts @@ -297,14 +290,6 @@ def delete_branch_on_merge(self): self._completeIfNotSet(self._delete_branch_on_merge) return self._delete_branch_on_merge.value - @property - def deployments_url(self): - """ - :type: string - """ - self._completeIfNotSet(self._deployments_url) - return self._deployments_url.value - @property def description(self): """ @@ -417,14 +402,6 @@ def has_issues(self): self._completeIfNotSet(self._has_issues) return self._has_issues.value - @property - def has_pages(self): - """ - :type: bool - """ - self._completeIfNotSet(self._has_pages) - return self._has_pages.value - @property def has_projects(self): """ @@ -473,6 +450,14 @@ def id(self): self._completeIfNotSet(self._id) return self._id.value + @property + def is_template(self): + """ + :type: bool + """ + self._completeIfNotSet(self._is_template) + return self._is_template.value + @property def issue_comment_url(self): """ @@ -657,14 +642,6 @@ def pushed_at(self): self._completeIfNotSet(self._pushed_at) return self._pushed_at.value - @property - def releases_url(self): - """ - :type: string - """ - self._completeIfNotSet(self._releases_url) - return self._releases_url.value - @property def size(self): """ @@ -763,6 +740,14 @@ def teams_url(self): self._completeIfNotSet(self._teams_url) return self._teams_url.value + @property + def topics(self): + """ + :type: list of strings + """ + self._completeIfNotSet(self._topics) + return self._topics.value + @property def trees_url(self): """ @@ -826,7 +811,7 @@ def add_to_collaborators(self, collaborator, permission=github.GithubObject.NotS put_parameters = None headers, data = self._requester.requestJsonAndCheck( - "PUT", f"{self.url}/collaborators/{collaborator}", input=put_parameters + "PUT", self.url + "/collaborators/" + collaborator, input=put_parameters ) # return an invitation object if there's data returned by the API. If data is empty # there's a pending invitation for the given user. @@ -848,32 +833,31 @@ def get_collaborator_permission(self, collaborator): if isinstance(collaborator, github.NamedUser.NamedUser): collaborator = collaborator._identity headers, data = self._requester.requestJsonAndCheck( - "GET", - f"{self.url}/collaborators/{collaborator}/permission", + "GET", self.url + "/collaborators/" + collaborator + "/permission", ) return data["permission"] def get_pending_invitations(self): """ - :calls: `GET /repos/{owner}/{repo}/invitations `_ + :calls: `GET /repos/:owner/:repo/invitations `_ :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Invitation.Invitation` """ return github.PaginatedList.PaginatedList( github.Invitation.Invitation, self._requester, - f"{self.url}/invitations", + self.url + "/invitations", None, ) def remove_invitation(self, invite_id): """ - :calls: `DELETE /repos/{owner}/{repo}/invitations/{invitation_id} `_ + :calls: `DELETE /repos/:owner/:repo/invitations/:invitation_id `_ :rtype: None """ assert isinstance(invite_id, int), invite_id headers, data = self._requester.requestJsonAndCheck( - "DELETE", f"{self.url}/invitations/{invite_id}" + "DELETE", self.url + "/invitations/" + str(invite_id) ) def compare(self, base, head): @@ -886,7 +870,7 @@ def compare(self, base, head): assert isinstance(base, str), base assert isinstance(head, str), head headers, data = self._requester.requestJsonAndCheck( - "GET", f"{self.url}/compare/{base}...{head}" + "GET", self.url + "/compare/" + base + "..." + head ) return github.Comparison.Comparison( self._requester, headers, data, completed=True @@ -906,7 +890,7 @@ def create_git_blob(self, content, encoding): "encoding": encoding, } headers, data = self._requester.requestJsonAndCheck( - "POST", f"{self.url}/git/blobs", input=post_parameters + "POST", self.url + "/git/blobs", input=post_parameters ) return github.GitBlob.GitBlob(self._requester, headers, data, completed=True) @@ -948,7 +932,7 @@ def create_git_commit( if committer is not github.GithubObject.NotSet: post_parameters["committer"] = committer._identity headers, data = self._requester.requestJsonAndCheck( - "POST", f"{self.url}/git/commits", input=post_parameters + "POST", self.url + "/git/commits", input=post_parameters ) return github.GitCommit.GitCommit( self._requester, headers, data, completed=True @@ -968,7 +952,7 @@ def create_git_ref(self, ref, sha): "sha": sha, } headers, data = self._requester.requestJsonAndCheck( - "POST", f"{self.url}/git/refs", input=post_parameters + "POST", self.url + "/git/refs", input=post_parameters ) return github.GitRef.GitRef(self._requester, headers, data, completed=True) @@ -984,21 +968,6 @@ def create_git_tag_and_release( draft=False, prerelease=False, ): - """ - Convenience function that calls :meth:`Repository.create_git_tag` and - :meth:`Repository.create_git_release`. - - :param tag: string - :param tag_message: string - :param release_name: string - :param release_message: string - :param object: string - :param type: string - :param tagger: :class:github.InputGitAuthor.InputGitAuthor - :param draft: bool - :param prerelease: bool - :rtype: :class:`github.GitRelease.GitRelease` - """ self.create_git_tag(tag, tag_message, object, type, tagger) return self.create_git_release( tag, @@ -1058,7 +1027,7 @@ def create_git_release( ): post_parameters["target_commitish"] = target_commitish.sha headers, data = self._requester.requestJsonAndCheck( - "POST", f"{self.url}/releases", input=post_parameters + "POST", self.url + "/releases", input=post_parameters ) return github.GitRelease.GitRelease( self._requester, headers, data, completed=True @@ -1092,7 +1061,7 @@ def create_git_tag( if tagger is not github.GithubObject.NotSet: post_parameters["tagger"] = tagger._identity headers, data = self._requester.requestJsonAndCheck( - "POST", f"{self.url}/git/tags", input=post_parameters + "POST", self.url + "/git/tags", input=post_parameters ) return github.GitTag.GitTag(self._requester, headers, data, completed=True) @@ -1115,7 +1084,7 @@ def create_git_tree(self, tree, base_tree=github.GithubObject.NotSet): if base_tree is not github.GithubObject.NotSet: post_parameters["base_tree"] = base_tree._identity headers, data = self._requester.requestJsonAndCheck( - "POST", f"{self.url}/git/trees", input=post_parameters + "POST", self.url + "/git/trees", input=post_parameters ) return github.GitTree.GitTree(self._requester, headers, data, completed=True) @@ -1149,7 +1118,7 @@ def create_hook( if active is not github.GithubObject.NotSet: post_parameters["active"] = active headers, data = self._requester.requestJsonAndCheck( - "POST", f"{self.url}/hooks", input=post_parameters + "POST", self.url + "/hooks", input=post_parameters ) return github.Hook.Hook(self._requester, headers, data, completed=True) @@ -1216,7 +1185,7 @@ def create_issue( for element in labels ] headers, data = self._requester.requestJsonAndCheck( - "POST", f"{self.url}/issues", input=post_parameters + "POST", self.url + "/issues", input=post_parameters ) return github.Issue.Issue(self._requester, headers, data, completed=True) @@ -1237,7 +1206,7 @@ def create_key(self, title, key, read_only=False): "read_only": read_only, } headers, data = self._requester.requestJsonAndCheck( - "POST", f"{self.url}/keys", input=post_parameters + "POST", self.url + "/keys", input=post_parameters ) return github.RepositoryKey.RepositoryKey( self._requester, headers, data, completed=True @@ -1264,7 +1233,7 @@ def create_label(self, name, color, description=github.GithubObject.NotSet): post_parameters["description"] = description headers, data = self._requester.requestJsonAndCheck( "POST", - f"{self.url}/labels", + self.url + "/labels", input=post_parameters, headers={"Accept": Consts.mediaTypeLabelDescriptionSearchPreview}, ) @@ -1306,7 +1275,7 @@ def create_milestone( else: post_parameters["due_on"] = due_on.isoformat() headers, data = self._requester.requestJsonAndCheck( - "POST", f"{self.url}/milestones", input=post_parameters + "POST", self.url + "/milestones", input=post_parameters ) return github.Milestone.Milestone( self._requester, headers, data, completed=True @@ -1314,7 +1283,7 @@ def create_milestone( def create_project(self, name, body=github.GithubObject.NotSet): """ - :calls: `POST /repos/{owner}/{repo}/projects `_ + :calls: `POST /repos/:owner/:repo/projects `_ :param name: string :param body: string :rtype: :class:`github.Project.Project` @@ -1328,7 +1297,7 @@ def create_project(self, name, body=github.GithubObject.NotSet): if body is not github.GithubObject.NotSet: post_parameters["body"] = body headers, data = self._requester.requestJsonAndCheck( - "POST", f"{self.url}/projects", headers=import_header, input=post_parameters + "POST", self.url + "/projects", headers=import_header, input=post_parameters ) return github.Project.Project(self._requester, headers, data, completed=True) @@ -1340,7 +1309,6 @@ def create_pull(self, *args, **kwds): :param issue: :class:`github.Issue.Issue` :param base: string :param head: string - :param draft: bool :param maintainer_can_modify: bool :rtype: :class:`github.PullRequest.PullRequest` """ @@ -1350,13 +1318,7 @@ def create_pull(self, *args, **kwds): return self.__create_pull_2(*args, **kwds) def __create_pull_1( - self, - title, - body, - base, - head, - maintainer_can_modify=github.GithubObject.NotSet, - draft=False, + self, title, body, base, head, maintainer_can_modify=github.GithubObject.NotSet ): assert isinstance(title, str), title assert isinstance(body, str), body @@ -1365,7 +1327,6 @@ def __create_pull_1( assert maintainer_can_modify is github.GithubObject.NotSet or isinstance( maintainer_can_modify, bool ), maintainer_can_modify - assert isinstance(draft, bool), draft if maintainer_can_modify is not github.GithubObject.NotSet: return self.__create_pull( title=title, @@ -1373,12 +1334,9 @@ def __create_pull_1( base=base, head=head, maintainer_can_modify=maintainer_can_modify, - draft=draft, ) else: - return self.__create_pull( - title=title, body=body, base=base, head=head, draft=draft - ) + return self.__create_pull(title=title, body=body, base=base, head=head) def __create_pull_2(self, issue, base, head): assert isinstance(issue, github.Issue.Issue), issue @@ -1388,67 +1346,13 @@ def __create_pull_2(self, issue, base, head): def __create_pull(self, **kwds): post_parameters = kwds - headers, data = self._requester.requestJsonAndCheck( - "POST", f"{self.url}/pulls", input=post_parameters + "POST", self.url + "/pulls", input=post_parameters ) return github.PullRequest.PullRequest( self._requester, headers, data, completed=True ) - def create_repository_dispatch( - self, event_type, client_payload=github.GithubObject.NotSet - ): - """ - :calls: POST /repos/{owner}/{repo}/dispatches - :param event_type: string - :param client_payload: dict - :rtype: bool - """ - assert isinstance(event_type, str), event_type - assert client_payload is github.GithubObject.NotSet or isinstance( - client_payload, dict - ), client_payload - post_parameters = {"event_type": event_type} - if client_payload is not github.GithubObject.NotSet: - post_parameters["client_payload"] = client_payload - status, headers, data = self._requester.requestJson( - "POST", f"{self.url}/dispatches", input=post_parameters - ) - return status == 204 - - def create_secret(self, secret_name, unencrypted_value): - """ - :calls: `PUT /repos/{owner}/{repo}/actions/secrets/{secret_name} `_ - :param secret_name: string - :param unencrypted_value: string - :rtype: bool - """ - assert isinstance(secret_name, str), secret_name - assert isinstance(unencrypted_value, str), unencrypted_value - public_key = self.get_public_key() - payload = public_key.encrypt(unencrypted_value) - put_parameters = { - "key_id": public_key.key_id, - "encrypted_value": payload, - } - status, headers, data = self._requester.requestJson( - "PUT", f"{self.url}/actions/secrets/{secret_name}", input=put_parameters - ) - return status == 201 - - def delete_secret(self, secret_name): - """ - :calls: `DELETE /repos/{owner}/{repo}/actions/secrets/{secret_name} `_ - :param secret_name: string - :rtype: bool - """ - assert isinstance(secret_name, str), secret_name - status, headers, data = self._requester.requestJson( - "DELETE", f"{self.url}/actions/secrets/{secret_name}" - ) - return status == 204 - def create_source_import( self, vcs, @@ -1483,7 +1387,7 @@ def create_source_import( import_header = {"Accept": Consts.mediaTypeImportPreview} headers, data = self._requester.requestJsonAndCheck( - "PUT", f"{self.url}/import", headers=import_header, input=put_parameters + "PUT", self.url + "/import", headers=import_header, input=put_parameters ) return github.SourceImport.SourceImport( @@ -1617,9 +1521,9 @@ def get_archive_link(self, archive_format, ref=github.GithubObject.NotSet): """ assert isinstance(archive_format, str), archive_format assert ref is github.GithubObject.NotSet or isinstance(ref, str), ref - url = f"{self.url}/{archive_format}" + url = self.url + "/" + archive_format if ref is not github.GithubObject.NotSet: - url += f"/{ref}" + url += "/" + ref headers, data = self._requester.requestJsonAndCheck("GET", url) return headers["location"] @@ -1629,7 +1533,7 @@ def get_assignees(self): :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser` """ return github.PaginatedList.PaginatedList( - github.NamedUser.NamedUser, self._requester, f"{self.url}/assignees", None + github.NamedUser.NamedUser, self._requester, self.url + "/assignees", None ) def get_branch(self, branch): @@ -1640,7 +1544,7 @@ def get_branch(self, branch): """ assert isinstance(branch, str), branch headers, data = self._requester.requestJsonAndCheck( - "GET", f"{self.url}/branches/{branch}" + "GET", self.url + "/branches/" + branch ) return github.Branch.Branch(self._requester, headers, data, completed=True) @@ -1650,7 +1554,7 @@ def get_branches(self): :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Branch.Branch` """ return github.PaginatedList.PaginatedList( - github.Branch.Branch, self._requester, f"{self.url}/branches", None + github.Branch.Branch, self._requester, self.url + "/branches", None ) def get_collaborators(self, affiliation=github.GithubObject.NotSet): @@ -1666,13 +1570,13 @@ def get_collaborators(self, affiliation=github.GithubObject.NotSet): assert isinstance(affiliation, str), affiliation assert ( affiliation in allowed_affiliations - ), f"Affiliation can be one of {', '.join(allowed_affiliations)}" + ), "Affiliation can be one of " + ", ".join(allowed_affiliations) url_parameters["affiliation"] = affiliation return github.PaginatedList.PaginatedList( github.NamedUser.NamedUser, self._requester, - f"{self.url}/collaborators", + self.url + "/collaborators", url_parameters, ) @@ -1684,7 +1588,7 @@ def get_comment(self, id): """ assert isinstance(id, int), id headers, data = self._requester.requestJsonAndCheck( - "GET", f"{self.url}/comments/{id}" + "GET", self.url + "/comments/" + str(id) ) return github.CommitComment.CommitComment( self._requester, headers, data, completed=True @@ -1698,7 +1602,7 @@ def get_comments(self): return github.PaginatedList.PaginatedList( github.CommitComment.CommitComment, self._requester, - f"{self.url}/comments", + self.url + "/comments", None, ) @@ -1710,7 +1614,7 @@ def get_commit(self, sha): """ assert isinstance(sha, str), sha headers, data = self._requester.requestJsonAndCheck( - "GET", f"{self.url}/commits/{sha}" + "GET", self.url + "/commits/" + sha ) return github.Commit.Commit(self._requester, headers, data, completed=True) @@ -1768,7 +1672,7 @@ def get_commits( else: url_parameters["author"] = author return github.PaginatedList.PaginatedList( - github.Commit.Commit, self._requester, f"{self.url}/commits", url_parameters + github.Commit.Commit, self._requester, self.url + "/commits", url_parameters ) def get_contents(self, path, ref=github.GithubObject.NotSet): @@ -1788,7 +1692,7 @@ def get_contents(self, path, ref=github.GithubObject.NotSet): url_parameters["ref"] = ref headers, data = self._requester.requestJsonAndCheck( "GET", - f"{self.url}/contents/{urllib.parse.quote(path)}", + self.url + "/contents/" + urllib.parse.quote(path), parameters=url_parameters, ) @@ -1811,145 +1715,13 @@ def get_contents(self, path, ref=github.GithubObject.NotSet): self._requester, headers, data, completed=True ) - def get_deployments( - self, - sha=github.GithubObject.NotSet, - ref=github.GithubObject.NotSet, - task=github.GithubObject.NotSet, - environment=github.GithubObject.NotSet, - ): - """ - :calls: `GET /repos/{owner}/{repo}/deployments `_ - :param: sha: string - :param: ref: string - :param: task: string - :param: environment: string - :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Deployment.Deployment` - """ - assert sha is github.GithubObject.NotSet or isinstance(sha, str), sha - assert ref is github.GithubObject.NotSet or isinstance(ref, str), ref - assert task is github.GithubObject.NotSet or isinstance(task, str), task - assert environment is github.GithubObject.NotSet or isinstance( - environment, str - ), environment - parameters = {} - if sha is not github.GithubObject.NotSet: - parameters["sha"] = sha - if ref is not github.GithubObject.NotSet: - parameters["ref"] = ref - if task is not github.GithubObject.NotSet: - parameters["task"] = task - if environment is not github.GithubObject.NotSet: - parameters["environment"] = environment - return github.PaginatedList.PaginatedList( - github.Deployment.Deployment, - self._requester, - f"{self.url}/deployments", - parameters, - headers={"Accept": Consts.deploymentEnhancementsPreview}, - ) - - def get_deployment(self, id_): - """ - :calls: `GET /repos/{owner}/{repo}/deployments/{deployment_id} `_ - :param: id_: int - :rtype: :class:`github.Deployment.Deployment` - """ - assert isinstance(id_, int), id_ - headers, data = self._requester.requestJsonAndCheck( - "GET", - f"{self.url}/deployments/{id_}", - headers={"Accept": Consts.deploymentEnhancementsPreview}, - ) - return github.Deployment.Deployment( - self._requester, headers, data, completed=True - ) - - def create_deployment( - self, - ref, - task=github.GithubObject.NotSet, - auto_merge=github.GithubObject.NotSet, - required_contexts=github.GithubObject.NotSet, - payload=github.GithubObject.NotSet, - environment=github.GithubObject.NotSet, - description=github.GithubObject.NotSet, - transient_environment=github.GithubObject.NotSet, - production_environment=github.GithubObject.NotSet, - ): - """ - :calls: `POST /repos/{owner}/{repo}/deployments `_ - :param: ref: string - :param: task: string - :param: auto_merge: bool - :param: required_contexts: list of status contexts - :param: payload: dict - :param: environment: string - :param: description: string - :param: transient_environment: bool - :param: production_environment: bool - :rtype: :class:`github.Deployment.Deployment` - """ - assert isinstance(ref, str), ref - assert task is github.GithubObject.NotSet or isinstance(task, str), task - assert auto_merge is github.GithubObject.NotSet or isinstance( - auto_merge, bool - ), auto_merge - assert required_contexts is github.GithubObject.NotSet or isinstance( - required_contexts, list - ), required_contexts # need to do better checking here - assert payload is github.GithubObject.NotSet or isinstance( - payload, dict - ), payload - assert environment is github.GithubObject.NotSet or isinstance( - environment, str - ), environment - assert description is github.GithubObject.NotSet or isinstance( - description, str - ), description - assert transient_environment is github.GithubObject.NotSet or isinstance( - transient_environment, bool - ), transient_environment - assert production_environment is github.GithubObject.NotSet or isinstance( - production_environment, bool - ), production_environment - - post_parameters = {"ref": ref} - if task is not github.GithubObject.NotSet: - post_parameters["task"] = task - if auto_merge is not github.GithubObject.NotSet: - post_parameters["auto_merge"] = auto_merge - if required_contexts is not github.GithubObject.NotSet: - post_parameters["required_contexts"] = required_contexts - if payload is not github.GithubObject.NotSet: - post_parameters["payload"] = payload - if environment is not github.GithubObject.NotSet: - post_parameters["environment"] = environment - if description is not github.GithubObject.NotSet: - post_parameters["description"] = description - if transient_environment is not github.GithubObject.NotSet: - post_parameters["transient_environment"] = transient_environment - if production_environment is not github.GithubObject.NotSet: - post_parameters["production_environment"] = production_environment - - headers, data = self._requester.requestJsonAndCheck( - "POST", - f"{self.url}/deployments", - input=post_parameters, - headers={"Accept": Consts.deploymentEnhancementsPreview}, - ) - - return github.Deployment.Deployment( - self._requester, headers, data, completed=True - ) - def get_top_referrers(self): """ - :calls: `GET /repos/{owner}/{repo}/traffic/popular/referrers `_ + :calls: `GET /repos/:owner/:repo/traffic/popular/referrers `_ :rtype: :class:`list` of :class:`github.Referrer.Referrer` """ headers, data = self._requester.requestJsonAndCheck( - "GET", f"{self.url}/traffic/popular/referrers" + "GET", self.url + "/traffic/popular/referrers" ) if isinstance(data, list): return [ @@ -1959,11 +1731,11 @@ def get_top_referrers(self): def get_top_paths(self): """ - :calls: `GET /repos/{owner}/{repo}/traffic/popular/paths `_ + :calls: `GET /repos/:owner/:repo/traffic/popular/paths `_ :rtype: :class:`list` of :class:`github.Path.Path` """ headers, data = self._requester.requestJsonAndCheck( - "GET", f"{self.url}/traffic/popular/paths" + "GET", self.url + "/traffic/popular/paths" ) if isinstance(data, list): return [ @@ -1973,7 +1745,7 @@ def get_top_paths(self): def get_views_traffic(self, per=github.GithubObject.NotSet): """ - :calls: `GET /repos/{owner}/{repo}/traffic/views `_ + :calls: `GET /repos/:owner/:repo/traffic/views `_ :param per: string, must be one of day or week, day by default :rtype: None or list of :class:`github.View.View` """ @@ -1984,7 +1756,7 @@ def get_views_traffic(self, per=github.GithubObject.NotSet): if per is not github.GithubObject.NotSet: url_parameters["per"] = per headers, data = self._requester.requestJsonAndCheck( - "GET", f"{self.url}/traffic/views", parameters=url_parameters + "GET", self.url + "/traffic/views", parameters=url_parameters ) if ( (isinstance(data, dict)) @@ -1999,9 +1771,9 @@ def get_views_traffic(self, per=github.GithubObject.NotSet): def get_clones_traffic(self, per=github.GithubObject.NotSet): """ - :calls: `GET /repos/{owner}/{repo}/traffic/clones `_ + :calls: `GET /repos/:owner/:repo/traffic/clones `_ :param per: string, must be one of day or week, day by default - :rtype: None or list of :class:`github.Clones.Clones` + :rtype: None or list of :class:`github.Clone.Clone` """ assert per is github.GithubObject.NotSet or ( isinstance(per, str) and (per == "day" or per == "week") @@ -2010,7 +1782,7 @@ def get_clones_traffic(self, per=github.GithubObject.NotSet): if per is not github.GithubObject.NotSet: url_parameters["per"] = per headers, data = self._requester.requestJsonAndCheck( - "GET", f"{self.url}/traffic/clones", parameters=url_parameters + "GET", self.url + "/traffic/clones", parameters=url_parameters ) if ( (isinstance(data, dict)) @@ -2025,7 +1797,7 @@ def get_clones_traffic(self, per=github.GithubObject.NotSet): def get_projects(self, state=github.GithubObject.NotSet): """ - :calls: `GET /repos/{owner}/{repo}/projects `_ + :calls: `GET /repos/:owner/:repo/projects `_ :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Project.Project` :param state: string """ @@ -2037,7 +1809,7 @@ def get_projects(self, state=github.GithubObject.NotSet): return github.PaginatedList.PaginatedList( github.Project.Project, self._requester, - f"{self.url}/projects", + self.url + "/projects", url_parameters, {"Accept": Consts.mediaTypeProjectsPreview}, ) @@ -2053,7 +1825,7 @@ def create_file( ): """Create a file in this repository. - :calls: `PUT /repos/{owner}/{repo}/contents/{path} `_ + :calls: `PUT /repos/:owner/:repo/contents/:path `_ :param path: string, (required), path of the file in the repository :param message: string, (required), commit message :param content: string, (required), the actual data in the file @@ -2089,7 +1861,7 @@ def create_file( headers, data = self._requester.requestJsonAndCheck( "PUT", - f"{self.url}/contents/{urllib.parse.quote(path)}", + self.url + "/contents/" + urllib.parse.quote(path), input=put_parameters, ) @@ -2114,7 +1886,7 @@ def update_file( ): """This method updates a file in a repository - :calls: `PUT /repos/{owner}/{repo}/contents/{path} `_ + :calls: `PUT /repos/:owner/:repo/contents/:path `_ :param path: string, Required. The content path. :param message: string, Required. The commit message. :param content: string, Required. The updated file content, either base64 encoded, or ready to be encoded. @@ -2153,7 +1925,7 @@ def update_file( headers, data = self._requester.requestJsonAndCheck( "PUT", - f"{self.url}/contents/{urllib.parse.quote(path)}", + self.url + "/contents/" + urllib.parse.quote(path), input=put_parameters, ) @@ -2177,6 +1949,7 @@ def delete_file( ): """This method deletes a file in a repository + :calls: `DELETE /repos/{owner}/{repo}/contents/{path} `_ :param path: string, Required. The content path. :param message: string, Required. The commit message. @@ -2211,7 +1984,7 @@ def delete_file( headers, data = self._requester.requestJsonAndCheck( "DELETE", - f"{self.url}/contents/{urllib.parse.quote(path)}", + self.url + "/contents/" + urllib.parse.quote(path), input=url_parameters, ) @@ -2250,7 +2023,7 @@ def get_contributors(self, anon=github.GithubObject.NotSet): return github.PaginatedList.PaginatedList( github.NamedUser.NamedUser, self._requester, - f"{self.url}/contributors", + self.url + "/contributors", url_parameters, ) @@ -2262,7 +2035,7 @@ def get_download(self, id): """ assert isinstance(id, int), id headers, data = self._requester.requestJsonAndCheck( - "GET", f"{self.url}/downloads/{id}" + "GET", self.url + "/downloads/" + str(id) ) return github.Download.Download(self._requester, headers, data, completed=True) @@ -2272,7 +2045,7 @@ def get_downloads(self): :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Download.Download` """ return github.PaginatedList.PaginatedList( - github.Download.Download, self._requester, f"{self.url}/downloads", None + github.Download.Download, self._requester, self.url + "/downloads", None ) def get_events(self): @@ -2281,7 +2054,7 @@ def get_events(self): :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Event.Event` """ return github.PaginatedList.PaginatedList( - github.Event.Event, self._requester, f"{self.url}/events", None + github.Event.Event, self._requester, self.url + "/events", None ) def get_forks(self): @@ -2290,7 +2063,7 @@ def get_forks(self): :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Repository.Repository` """ return github.PaginatedList.PaginatedList( - Repository, self._requester, f"{self.url}/forks", None + Repository, self._requester, self.url + "/forks", None ) def create_fork(self, organization=github.GithubObject.NotSet): @@ -2306,9 +2079,7 @@ def create_fork(self, organization=github.GithubObject.NotSet): if organization is not github.GithubObject.NotSet: post_parameters["organization"] = organization headers, data = self._requester.requestJsonAndCheck( - "POST", - f"{self.url}/forks", - input=post_parameters, + "POST", self.url + "/forks", input=post_parameters, ) return Repository(self._requester, headers, data, completed=True) @@ -2320,7 +2091,7 @@ def get_git_blob(self, sha): """ assert isinstance(sha, str), sha headers, data = self._requester.requestJsonAndCheck( - "GET", f"{self.url}/git/blobs/{sha}" + "GET", self.url + "/git/blobs/" + sha ) return github.GitBlob.GitBlob(self._requester, headers, data, completed=True) @@ -2332,7 +2103,7 @@ def get_git_commit(self, sha): """ assert isinstance(sha, str), sha headers, data = self._requester.requestJsonAndCheck( - "GET", f"{self.url}/git/commits/{sha}" + "GET", self.url + "/git/commits/" + sha ) return github.GitCommit.GitCommit( self._requester, headers, data, completed=True @@ -2349,7 +2120,7 @@ def get_git_ref(self, ref): prefix = "/git/" assert isinstance(ref, str), ref headers, data = self._requester.requestJsonAndCheck( - "GET", f"{self.url}{prefix}{ref}" + "GET", self.url + prefix + ref ) return github.GitRef.GitRef(self._requester, headers, data, completed=True) @@ -2383,7 +2154,7 @@ def get_git_tag(self, sha): """ assert isinstance(sha, str), sha headers, data = self._requester.requestJsonAndCheck( - "GET", f"{self.url}/git/tags/{sha}" + "GET", self.url + "/git/tags/" + sha ) return github.GitTag.GitTag(self._requester, headers, data, completed=True) @@ -2403,7 +2174,7 @@ def get_git_tree(self, sha, recursive=github.GithubObject.NotSet): # GitHub API requires the recursive parameter be set to 1. url_parameters["recursive"] = 1 headers, data = self._requester.requestJsonAndCheck( - "GET", f"{self.url}/git/trees/{sha}", parameters=url_parameters + "GET", self.url + "/git/trees/" + sha, parameters=url_parameters ) return github.GitTree.GitTree(self._requester, headers, data, completed=True) @@ -2415,7 +2186,7 @@ def get_hook(self, id): """ assert isinstance(id, int), id headers, data = self._requester.requestJsonAndCheck( - "GET", f"{self.url}/hooks/{id}" + "GET", self.url + "/hooks/" + str(id) ) return github.Hook.Hook(self._requester, headers, data, completed=True) @@ -2425,7 +2196,7 @@ def get_hooks(self): :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Hook.Hook` """ return github.PaginatedList.PaginatedList( - github.Hook.Hook, self._requester, f"{self.url}/hooks", None + github.Hook.Hook, self._requester, self.url + "/hooks", None ) def get_issue(self, number): @@ -2436,7 +2207,7 @@ def get_issue(self, number): """ assert isinstance(number, int), number headers, data = self._requester.requestJsonAndCheck( - "GET", f"{self.url}/issues/{number}" + "GET", self.url + "/issues/" + str(number) ) return github.Issue.Issue(self._requester, headers, data, completed=True) @@ -2530,7 +2301,7 @@ def get_issues( else: url_parameters["creator"] = creator._identity return github.PaginatedList.PaginatedList( - github.Issue.Issue, self._requester, f"{self.url}/issues", url_parameters + github.Issue.Issue, self._requester, self.url + "/issues", url_parameters ) def get_issues_comments( @@ -2563,7 +2334,7 @@ def get_issues_comments( return github.PaginatedList.PaginatedList( github.IssueComment.IssueComment, self._requester, - f"{self.url}/issues/comments", + self.url + "/issues/comments", url_parameters, ) @@ -2576,7 +2347,7 @@ def get_issues_event(self, id): assert isinstance(id, int), id headers, data = self._requester.requestJsonAndCheck( "GET", - f"{self.url}/issues/events/{id}", + self.url + "/issues/events/" + str(id), headers={"Accept": Consts.mediaTypeLockReasonPreview}, ) return github.IssueEvent.IssueEvent( @@ -2591,7 +2362,7 @@ def get_issues_events(self): return github.PaginatedList.PaginatedList( github.IssueEvent.IssueEvent, self._requester, - f"{self.url}/issues/events", + self.url + "/issues/events", None, headers={"Accept": Consts.mediaTypeLockReasonPreview}, ) @@ -2604,7 +2375,7 @@ def get_key(self, id): """ assert isinstance(id, int), id headers, data = self._requester.requestJsonAndCheck( - "GET", f"{self.url}/keys/{id}" + "GET", self.url + "/keys/" + str(id) ) return github.RepositoryKey.RepositoryKey( self._requester, headers, data, completed=True @@ -2618,7 +2389,7 @@ def get_keys(self): return github.PaginatedList.PaginatedList( github.RepositoryKey.RepositoryKey, self._requester, - f"{self.url}/keys", + self.url + "/keys", None, ) @@ -2630,7 +2401,7 @@ def get_label(self, name): """ assert isinstance(name, str), name headers, data = self._requester.requestJsonAndCheck( - "GET", f"{self.url}/labels/{urllib.parse.quote(name)}" + "GET", self.url + "/labels/" + urllib.parse.quote(name) ) return github.Label.Label(self._requester, headers, data, completed=True) @@ -2640,7 +2411,7 @@ def get_labels(self): :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Label.Label` """ return github.PaginatedList.PaginatedList( - github.Label.Label, self._requester, f"{self.url}/labels", None + github.Label.Label, self._requester, self.url + "/labels", None ) def get_languages(self): @@ -2649,18 +2420,18 @@ def get_languages(self): :rtype: dict of string to integer """ headers, data = self._requester.requestJsonAndCheck( - "GET", f"{self.url}/languages" + "GET", self.url + "/languages" ) return data def get_license(self): """ - :calls: `GET /repos/{owner}/{repo}/license `_ + :calls: `GET /repos/:owner/:repo/license `_ :rtype: :class:`github.ContentFile.ContentFile` """ headers, data = self._requester.requestJsonAndCheck( - "GET", f"{self.url}/license" + "GET", self.url + "/license" ) return github.ContentFile.ContentFile( self._requester, headers, data, completed=True @@ -2674,7 +2445,7 @@ def get_milestone(self, number): """ assert isinstance(number, int), number headers, data = self._requester.requestJsonAndCheck( - "GET", f"{self.url}/milestones/{number}" + "GET", self.url + "/milestones/" + str(number) ) return github.Milestone.Milestone( self._requester, headers, data, completed=True @@ -2708,7 +2479,7 @@ def get_milestones( return github.PaginatedList.PaginatedList( github.Milestone.Milestone, self._requester, - f"{self.url}/milestones", + self.url + "/milestones", url_parameters, ) @@ -2720,22 +2491,10 @@ def get_network_events(self): return github.PaginatedList.PaginatedList( github.Event.Event, self._requester, - f"/networks/{self.owner.login}/{self.name}/events", + "/networks/" + self.owner.login + "/" + self.name + "/events", None, ) - def get_public_key(self): - """ - :calls: `GET /repos/{owner}/{repo}/actions/secrets/public-key `_ - :rtype: :class:`github.PublicKey.PublicKey` - """ - headers, data = self._requester.requestJsonAndCheck( - "GET", f"{self.url}/actions/secrets/public-key" - ) - return github.PublicKey.PublicKey( - self._requester, headers, data, completed=True - ) - def get_pull(self, number): """ :calls: `GET /repos/{owner}/{repo}/pulls/{number} `_ @@ -2744,7 +2503,7 @@ def get_pull(self, number): """ assert isinstance(number, int), number headers, data = self._requester.requestJsonAndCheck( - "GET", f"{self.url}/pulls/{number}" + "GET", self.url + "/pulls/" + str(number) ) return github.PullRequest.PullRequest( self._requester, headers, data, completed=True @@ -2788,7 +2547,7 @@ def get_pulls( return github.PaginatedList.PaginatedList( github.PullRequest.PullRequest, self._requester, - f"{self.url}/pulls", + self.url + "/pulls", url_parameters, ) @@ -2837,7 +2596,7 @@ def get_pulls_review_comments( return github.PaginatedList.PaginatedList( github.PullRequestComment.PullRequestComment, self._requester, - f"{self.url}/pulls/comments", + self.url + "/pulls/comments", url_parameters, ) @@ -2852,39 +2611,12 @@ def get_readme(self, ref=github.GithubObject.NotSet): if ref is not github.GithubObject.NotSet: url_parameters["ref"] = ref headers, data = self._requester.requestJsonAndCheck( - "GET", f"{self.url}/readme", parameters=url_parameters + "GET", self.url + "/readme", parameters=url_parameters ) return github.ContentFile.ContentFile( self._requester, headers, data, completed=True ) - def get_self_hosted_runner(self, runner_id): - """ - :calls: `GET /repos/{owner}/{repo}/actions/runners/{id} `_ - :param runner_id: int - :rtype: :class:`github.SelfHostedActionsRunner.SelfHostedActionsRunner` - """ - assert isinstance(runner_id, int), runner_id - headers, data = self._requester.requestJsonAndCheck( - "GET", f"{self.url}/actions/runners/{runner_id}" - ) - return github.SelfHostedActionsRunner.SelfHostedActionsRunner( - self._requester, headers, data, completed=True - ) - - def get_self_hosted_runners(self): - """ - :calls: `GET /repos/{owner}/{repo}/actions/runners `_ - :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.SelfHostedActionsRunner.SelfHostedActionsRunner` - """ - return github.PaginatedList.PaginatedList( - github.SelfHostedActionsRunner.SelfHostedActionsRunner, - self._requester, - f"{self.url}/actions/runners", - None, - list_item="runners", - ) - def get_source_import(self): """ :calls: `GET /repos/{owner}/{repo}/import `_ @@ -2892,9 +2624,7 @@ def get_source_import(self): """ import_header = {"Accept": Consts.mediaTypeImportPreview} headers, data = self._requester.requestJsonAndCheck( - "GET", - f"{self.url}/import", - headers=import_header, + "GET", self.url + "/import", headers=import_header, ) if not data: return None @@ -2909,7 +2639,7 @@ def get_stargazers(self): :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser` """ return github.PaginatedList.PaginatedList( - github.NamedUser.NamedUser, self._requester, f"{self.url}/stargazers", None + github.NamedUser.NamedUser, self._requester, self.url + "/stargazers", None ) def get_stargazers_with_dates(self): @@ -2920,7 +2650,7 @@ def get_stargazers_with_dates(self): return github.PaginatedList.PaginatedList( github.Stargazer.Stargazer, self._requester, - f"{self.url}/stargazers", + self.url + "/stargazers", None, headers={"Accept": Consts.mediaTypeStarringPreview}, ) @@ -2931,7 +2661,7 @@ def get_stats_contributors(self): :rtype: None or list of :class:`github.StatsContributor.StatsContributor` """ headers, data = self._requester.requestJsonAndCheck( - "GET", f"{self.url}/stats/contributors" + "GET", self.url + "/stats/contributors" ) if not data: return None @@ -2949,7 +2679,7 @@ def get_stats_commit_activity(self): :rtype: None or list of :class:`github.StatsCommitActivity.StatsCommitActivity` """ headers, data = self._requester.requestJsonAndCheck( - "GET", f"{self.url}/stats/commit_activity" + "GET", self.url + "/stats/commit_activity" ) if not data: return None @@ -2967,7 +2697,7 @@ def get_stats_code_frequency(self): :rtype: None or list of :class:`github.StatsCodeFrequency.StatsCodeFrequency` """ headers, data = self._requester.requestJsonAndCheck( - "GET", f"{self.url}/stats/code_frequency" + "GET", self.url + "/stats/code_frequency" ) if not data: return None @@ -2985,7 +2715,7 @@ def get_stats_participation(self): :rtype: None or :class:`github.StatsParticipation.StatsParticipation` """ headers, data = self._requester.requestJsonAndCheck( - "GET", f"{self.url}/stats/participation" + "GET", self.url + "/stats/participation" ) if not data: return None @@ -3000,7 +2730,7 @@ def get_stats_punch_card(self): :rtype: None or :class:`github.StatsPunchCard.StatsPunchCard` """ headers, data = self._requester.requestJsonAndCheck( - "GET", f"{self.url}/stats/punch_card" + "GET", self.url + "/stats/punch_card" ) if not data: return None @@ -3015,7 +2745,7 @@ def get_subscribers(self): :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser` """ return github.PaginatedList.PaginatedList( - github.NamedUser.NamedUser, self._requester, f"{self.url}/subscribers", None + github.NamedUser.NamedUser, self._requester, self.url + "/subscribers", None ) def get_tags(self): @@ -3024,7 +2754,7 @@ def get_tags(self): :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Tag.Tag` """ return github.PaginatedList.PaginatedList( - github.Tag.Tag, self._requester, f"{self.url}/tags", None + github.Tag.Tag, self._requester, self.url + "/tags", None ) def get_releases(self): @@ -3033,7 +2763,7 @@ def get_releases(self): :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.GitRelease.GitRelease` """ return github.PaginatedList.PaginatedList( - github.GitRelease.GitRelease, self._requester, f"{self.url}/releases", None + github.GitRelease.GitRelease, self._requester, self.url + "/releases", None ) def get_release(self, id): @@ -3044,14 +2774,14 @@ def get_release(self, id): """ if isinstance(id, int): headers, data = self._requester.requestJsonAndCheck( - "GET", f"{self.url}/releases/{id}" + "GET", self.url + "/releases/" + str(id) ) return github.GitRelease.GitRelease( self._requester, headers, data, completed=True ) elif isinstance(id, str): headers, data = self._requester.requestJsonAndCheck( - "GET", f"{self.url}/releases/tags/{id}" + "GET", self.url + "/releases/tags/" + id ) return github.GitRelease.GitRelease( self._requester, headers, data, completed=True @@ -3063,7 +2793,7 @@ def get_latest_release(self): :rtype: :class:`github.GitRelease.GitRelease` """ headers, data = self._requester.requestJsonAndCheck( - "GET", f"{self.url}/releases/latest" + "GET", self.url + "/releases/latest" ) return github.GitRelease.GitRelease( self._requester, headers, data, completed=True @@ -3075,7 +2805,7 @@ def get_teams(self): :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Team.Team` """ return github.PaginatedList.PaginatedList( - github.Team.Team, self._requester, f"{self.url}/teams", None + github.Team.Team, self._requester, self.url + "/teams", None ) def get_topics(self): @@ -3085,7 +2815,7 @@ def get_topics(self): """ headers, data = self._requester.requestJsonAndCheck( "GET", - f"{self.url}/topics", + self.url + "/topics", headers={"Accept": Consts.mediaTypeTopicsPreview}, ) return data["names"] @@ -3207,7 +2937,7 @@ def has_in_assignees(self, assignee): assignee = assignee._identity status, headers, data = self._requester.requestJson( - "GET", f"{self.url}/assignees/{assignee}" + "GET", self.url + "/assignees/" + assignee ) return status == 204 @@ -3225,17 +2955,17 @@ def has_in_collaborators(self, collaborator): collaborator = collaborator._identity status, headers, data = self._requester.requestJson( - "GET", f"{self.url}/collaborators/{collaborator}" + "GET", self.url + "/collaborators/" + collaborator ) return status == 204 def _legacy_convert_issue(self, attributes): convertedAttributes = { "number": attributes["number"], - "url": f"/repos{urllib.parse.urlparse(attributes['html_url']).path}", + "url": "/repos" + urllib.parse.urlparse(attributes["html_url"]).path, "user": { "login": attributes["user"], - "url": f"/users/{attributes['user']}", + "url": "/users/" + attributes["user"], }, } if "labels" in attributes: # pragma no branch @@ -3252,13 +2982,20 @@ def legacy_search_issues(self, state, keyword): :calls: `GET /legacy/issues/search/{owner}/{repository}/{state}/{keyword} `_ :param state: "open" or "closed" :param keyword: string - :rtype: List of :class:`github.Issue.Issue` + :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Issue.Issue` """ assert state in ["open", "closed"], state assert isinstance(keyword, str), keyword headers, data = self._requester.requestJsonAndCheck( "GET", - f"/legacy/issues/search/{self.owner.login}/{self.name}/{state}/{urllib.parse.quote(keyword)}", + "/legacy/issues/search/" + + self.owner.login + + "/" + + self.name + + "/" + + state + + "/" + + urllib.parse.quote(keyword), ) return [ github.Issue.Issue( @@ -3310,20 +3047,20 @@ def get_notifications( return github.PaginatedList.PaginatedList( github.Notification.Notification, self._requester, - f"{self.url}/notifications", + self.url + "/notifications", params, ) def mark_notifications_as_read(self, last_read_at=datetime.datetime.utcnow()): """ - :calls: `PUT /repos/{owner}/{repo}/notifications `_ + :calls: `PUT /repos/:owner/:repo/notifications `_ :param last_read_at: datetime """ assert isinstance(last_read_at, datetime.datetime) put_parameters = {"last_read_at": last_read_at.strftime("%Y-%m-%dT%H:%M:%SZ")} headers, data = self._requester.requestJsonAndCheck( - "PUT", f"{self.url}/notifications", input=put_parameters + "PUT", self.url + "/notifications", input=put_parameters ) def merge(self, base, head, commit_message=github.GithubObject.NotSet): @@ -3346,7 +3083,7 @@ def merge(self, base, head, commit_message=github.GithubObject.NotSet): if commit_message is not github.GithubObject.NotSet: post_parameters["commit_message"] = commit_message headers, data = self._requester.requestJsonAndCheck( - "POST", f"{self.url}/merges", input=post_parameters + "POST", self.url + "/merges", input=post_parameters ) if data is None: return None @@ -3362,7 +3099,7 @@ def replace_topics(self, topics): post_parameters = {"names": topics} headers, data = self._requester.requestJsonAndCheck( "PUT", - f"{self.url}/topics", + self.url + "/topics", headers={"Accept": Consts.mediaTypeTopicsPreview}, input=post_parameters, ) @@ -3374,7 +3111,7 @@ def get_vulnerability_alert(self): """ status, _, _ = self._requester.requestJson( "GET", - f"{self.url}/vulnerability-alerts", + self.url + "/vulnerability-alerts", headers={"Accept": Consts.vulnerabilityAlertsPreview}, ) return status == 204 @@ -3386,7 +3123,7 @@ def enable_vulnerability_alert(self): """ status, _, _ = self._requester.requestJson( "PUT", - f"{self.url}/vulnerability-alerts", + self.url + "/vulnerability-alerts", headers={"Accept": Consts.vulnerabilityAlertsPreview}, ) return status == 204 @@ -3398,7 +3135,7 @@ def disable_vulnerability_alert(self): """ status, _, _ = self._requester.requestJson( "DELETE", - f"{self.url}/vulnerability-alerts", + self.url + "/vulnerability-alerts", headers={"Accept": Consts.vulnerabilityAlertsPreview}, ) return status == 204 @@ -3410,7 +3147,7 @@ def enable_automated_security_fixes(self): """ status, _, _ = self._requester.requestJson( "PUT", - f"{self.url}/automated-security-fixes", + self.url + "/automated-security-fixes", headers={"Accept": Consts.automatedSecurityFixes}, ) return status == 204 @@ -3422,7 +3159,7 @@ def disable_automated_security_fixes(self): """ status, _, _ = self._requester.requestJson( "DELETE", - f"{self.url}/automated-security-fixes", + self.url + "/automated-security-fixes", headers={"Accept": Consts.automatedSecurityFixes}, ) return status == 204 @@ -3441,30 +3178,12 @@ def remove_from_collaborators(self, collaborator): collaborator = collaborator._identity headers, data = self._requester.requestJsonAndCheck( - "DELETE", f"{self.url}/collaborators/{collaborator}" - ) - - def remove_self_hosted_runner(self, runner): - """ - :calls: `DELETE /repos/{owner}/{repo}/actions/runners/{runner_id} `_ - :param runner: int or :class:`github.SelfHostedActionsRunner.SelfHostedActionsRunner` - :rtype: bool - """ - assert isinstance( - runner, github.SelfHostedActionsRunner.SelfHostedActionsRunner - ) or isinstance(runner, int), runner - - if isinstance(runner, github.SelfHostedActionsRunner.SelfHostedActionsRunner): - runner = runner.id - - status, _, _ = self._requester.requestJson( - "DELETE", f"{self.url}/actions/runners/{runner}" + "DELETE", self.url + "/collaborators/" + collaborator ) - return status == 204 def subscribe_to_hub(self, event, callback, secret=github.GithubObject.NotSet): """ - :calls: `POST /hub `_ + :calls: `POST /hub `_ :param event: string :param callback: string :param secret: string @@ -3474,7 +3193,7 @@ def subscribe_to_hub(self, event, callback, secret=github.GithubObject.NotSet): def unsubscribe_from_hub(self, event, callback): """ - :calls: `POST /hub `_ + :calls: `POST /hub `_ :param event: string :param callback: string :param secret: string @@ -3482,57 +3201,6 @@ def unsubscribe_from_hub(self, event, callback): """ return self._hub("unsubscribe", event, callback, github.GithubObject.NotSet) - def create_check_suite(self, head_sha): - """ - :calls: `POST /repos/{owner}/{repo}/check-suites `_ - :param head_sha: string - :rtype: :class:`github.CheckSuite.CheckSuite` - """ - assert isinstance(head_sha, str), head_sha - headers, data = self._requester.requestJsonAndCheck( - "POST", - f"{self.url}/check-suites", - input={"head_sha": head_sha}, - ) - return github.CheckSuite.CheckSuite( - self._requester, headers, data, completed=True - ) - - def get_check_suite(self, check_suite_id): - """ - :calls: `GET /repos/{owner}/{repo}/check-suites/{check_suite_id} `_ - :param check_suite_id: int - :rtype: :class:`github.CheckSuite.CheckSuite` - """ - assert isinstance(check_suite_id, int), check_suite_id - requestHeaders = {"Accept": "application/vnd.github.v3+json"} - headers, data = self._requester.requestJsonAndCheck( - "GET", - f"{self.url}/check-suites/{check_suite_id}", - headers=requestHeaders, - ) - return github.CheckSuite.CheckSuite( - self._requester, headers, data, completed=True - ) - - def update_check_suites_preferences(self, auto_trigger_checks): - """ - :calls: `PATCH /repos/{owner}/{repo}/check-suites/preferences `_ - :param auto_trigger_checks: list of dict - :rtype: :class:`github.RepositoryPreferences.RepositoryPreferences` - """ - assert all( - isinstance(element, dict) for element in auto_trigger_checks - ), auto_trigger_checks - headers, data = self._requester.requestJsonAndCheck( - "PATCH", - f"{self.url}/check-suites/preferences", - input={"auto_trigger_checks": auto_trigger_checks}, - ) - return github.RepositoryPreferences.RepositoryPreferences( - self._requester, headers, data, completed=True - ) - def _hub(self, mode, event, callback, secret): assert isinstance(mode, str), mode assert isinstance(event, str), event @@ -3541,9 +3209,9 @@ def _hub(self, mode, event, callback, secret): post_parameters = collections.OrderedDict() post_parameters["hub.callback"] = callback - post_parameters[ - "hub.topic" - ] = f"https://github.com/{self.full_name}/events/{event}" + post_parameters["hub.topic"] = ( + "https://github.com/" + self.full_name + "/events/" + event + ) post_parameters["hub.mode"] = mode if secret is not github.GithubObject.NotSet: post_parameters["hub.secret"] = secret @@ -3554,110 +3222,18 @@ def _hub(self, mode, event, callback, secret): @property def _identity(self): - return f"{self.owner.login}/{self.name}" + return self.owner.login + "/" + self.name def get_release_asset(self, id): assert isinstance(id, (int)), id resp_headers, data = self._requester.requestJsonAndCheck( - "GET", f"{self.url}/releases/assets/{id}" + "GET", self.url + "/releases/assets/" + str(id) ) return github.GitReleaseAsset.GitReleaseAsset( self._requester, resp_headers, data, completed=True ) - def create_check_run( - self, - name, - head_sha, - details_url=github.GithubObject.NotSet, - external_id=github.GithubObject.NotSet, - status=github.GithubObject.NotSet, - started_at=github.GithubObject.NotSet, - conclusion=github.GithubObject.NotSet, - completed_at=github.GithubObject.NotSet, - output=github.GithubObject.NotSet, - actions=github.GithubObject.NotSet, - ): - """ - :calls: `POST /repos/{owner}/{repo}/check-runs `_ - :param name: string - :param head_sha: string - :param details_url: string - :param external_id: string - :param status: string - :param started_at: datetime.datetime - :param conclusion: string - :param completed_at: datetime.datetime - :param output: dict - :param actions: list of dict - :rtype: :class:`github.CheckRun.CheckRun` - """ - assert isinstance(name, str), name - assert isinstance(head_sha, str), head_sha - assert details_url is github.GithubObject.NotSet or isinstance( - details_url, str - ), details_url - assert external_id is github.GithubObject.NotSet or isinstance( - external_id, str - ), external_id - assert status is github.GithubObject.NotSet or isinstance(status, str), status - assert started_at is github.GithubObject.NotSet or isinstance( - started_at, datetime.datetime - ), started_at - assert conclusion is github.GithubObject.NotSet or isinstance( - conclusion, str - ), conclusion - assert completed_at is github.GithubObject.NotSet or isinstance( - completed_at, datetime.datetime - ), completed_at - assert output is github.GithubObject.NotSet or isinstance(output, dict), output - assert actions is github.GithubObject.NotSet or all( - isinstance(element, dict) for element in actions - ), actions - - post_parameters = { - "name": name, - "head_sha": head_sha, - } - if details_url is not github.GithubObject.NotSet: - post_parameters["details_url"] = details_url - if external_id is not github.GithubObject.NotSet: - post_parameters["external_id"] = external_id - if status is not github.GithubObject.NotSet: - post_parameters["status"] = status - if started_at is not github.GithubObject.NotSet: - post_parameters["started_at"] = started_at.strftime("%Y-%m-%dT%H:%M:%SZ") - if completed_at is not github.GithubObject.NotSet: - post_parameters["completed_at"] = completed_at.strftime( - "%Y-%m-%dT%H:%M:%SZ" - ) - if conclusion is not github.GithubObject.NotSet: - post_parameters["conclusion"] = conclusion - if output is not github.GithubObject.NotSet: - post_parameters["output"] = output - if actions is not github.GithubObject.NotSet: - post_parameters["actions"] = actions - - headers, data = self._requester.requestJsonAndCheck( - "POST", - f"{self.url}/check-runs", - input=post_parameters, - ) - return github.CheckRun.CheckRun(self._requester, headers, data, completed=True) - - def get_check_run(self, check_run_id): - """ - :calls: `GET /repos/{owner}/{repo}/check-runs/{check_run_id} `_ - :param check_run_id: int - :rtype: :class:`github.CheckRun.CheckRun` - """ - assert isinstance(check_run_id, int), check_run_id - headers, data = self._requester.requestJsonAndCheck( - "GET", f"{self.url}/check-runs/{check_run_id}" - ) - return github.CheckRun.CheckRun(self._requester, headers, data, completed=True) - def _initAttributes(self): self._allow_merge_commit = github.GithubObject.NotSet self._allow_rebase_merge = github.GithubObject.NotSet @@ -3677,7 +3253,6 @@ def _initAttributes(self): self._created_at = github.GithubObject.NotSet self._default_branch = github.GithubObject.NotSet self._delete_branch_on_merge = github.GithubObject.NotSet - self._deployments_url = github.GithubObject.NotSet self._description = github.GithubObject.NotSet self._downloads_url = github.GithubObject.NotSet self._events_url = github.GithubObject.NotSet @@ -3692,13 +3267,13 @@ def _initAttributes(self): self._git_url = github.GithubObject.NotSet self._has_downloads = github.GithubObject.NotSet self._has_issues = github.GithubObject.NotSet - self._has_pages = github.GithubObject.NotSet self._has_projects = github.GithubObject.NotSet self._has_wiki = github.GithubObject.NotSet self._homepage = github.GithubObject.NotSet self._hooks_url = github.GithubObject.NotSet self._html_url = github.GithubObject.NotSet self._id = github.GithubObject.NotSet + self._is_template = github.GithubObject.NotSet self._issue_comment_url = github.GithubObject.NotSet self._issue_events_url = github.GithubObject.NotSet self._issues_url = github.GithubObject.NotSet @@ -3722,7 +3297,6 @@ def _initAttributes(self): self._private = github.GithubObject.NotSet self._pulls_url = github.GithubObject.NotSet self._pushed_at = github.GithubObject.NotSet - self._releases_url = github.GithubObject.NotSet self._size = github.GithubObject.NotSet self._source = github.GithubObject.NotSet self._ssh_url = github.GithubObject.NotSet @@ -3735,6 +3309,7 @@ def _initAttributes(self): self._svn_url = github.GithubObject.NotSet self._tags_url = github.GithubObject.NotSet self._teams_url = github.GithubObject.NotSet + self._topics = github.GithubObject.NotSet self._trees_url = github.GithubObject.NotSet self._updated_at = github.GithubObject.NotSet self._url = github.GithubObject.NotSet @@ -3792,10 +3367,6 @@ def _useAttributes(self, attributes): self._delete_branch_on_merge = self._makeBoolAttribute( attributes["delete_branch_on_merge"] ) - if "deployments_url" in attributes: # pragma no branch - self._deployments_url = self._makeStringAttribute( - attributes["deployments_url"] - ) if "description" in attributes: # pragma no branch self._description = self._makeStringAttribute(attributes["description"]) if "downloads_url" in attributes: # pragma no branch @@ -3826,8 +3397,6 @@ def _useAttributes(self, attributes): self._has_downloads = self._makeBoolAttribute(attributes["has_downloads"]) if "has_issues" in attributes: # pragma no branch self._has_issues = self._makeBoolAttribute(attributes["has_issues"]) - if "has_pages" in attributes: # pragma no branch - self._has_pages = self._makeBoolAttribute(attributes["has_pages"]) if "has_projects" in attributes: # pragma no branch self._has_projects = self._makeBoolAttribute(attributes["has_projects"]) if "has_wiki" in attributes: # pragma no branch @@ -3840,6 +3409,8 @@ def _useAttributes(self, attributes): self._html_url = self._makeStringAttribute(attributes["html_url"]) if "id" in attributes: # pragma no branch self._id = self._makeIntAttribute(attributes["id"]) + if "is_template" in attributes: # pragma no branch + self._is_template = self._makeBoolAttribute(attributes["is_template"]) if "issue_comment_url" in attributes: # pragma no branch self._issue_comment_url = self._makeStringAttribute( attributes["issue_comment_url"] @@ -3902,8 +3473,6 @@ def _useAttributes(self, attributes): self._pulls_url = self._makeStringAttribute(attributes["pulls_url"]) if "pushed_at" in attributes: # pragma no branch self._pushed_at = self._makeDatetimeAttribute(attributes["pushed_at"]) - if "releases_url" in attributes: # pragma no branch - self._releases_url = self._makeStringAttribute(attributes["releases_url"]) if "size" in attributes: # pragma no branch self._size = self._makeIntAttribute(attributes["size"]) if "source" in attributes: # pragma no branch @@ -3940,6 +3509,8 @@ def _useAttributes(self, attributes): self._teams_url = self._makeStringAttribute(attributes["teams_url"]) if "trees_url" in attributes: # pragma no branch self._trees_url = self._makeStringAttribute(attributes["trees_url"]) + if "topics" in attributes: # pragma no branch + self._topics = self._makeListOfStringsAttribute(attributes["topics"]) if "updated_at" in attributes: # pragma no branch self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"]) if "url" in attributes: # pragma no branch diff --git a/tests/AuthenticatedUser.py b/tests/AuthenticatedUser.py index 61edafe77b..1d87514ffe 100644 --- a/tests/AuthenticatedUser.py +++ b/tests/AuthenticatedUser.py @@ -324,9 +324,7 @@ def testSubscriptions(self): self.assertTrue(self.user.has_in_subscriptions(gitflow)) def testGetAuthorizations(self): - self.assertListKeyEqual( - self.user.get_authorizations(), lambda a: a.id, [372294] - ) + self.assertListKeyEqual(self.user.get_authorizations(), lambda a: a.id, [372294]) def testCreateRepository(self): repo = self.user.create_repo(name="TestPyGithub") @@ -411,9 +409,7 @@ def testGetEvents(self): def testGetOrganizationEvents(self): self.assertListKeyBegin( - self.user.get_organization_events( - self.g.get_organization("BeaverSoftware") - ), + self.user.get_organization_events(self.g.get_organization("BeaverSoftware")), lambda e: e.type, ["CreateEvent", "CreateEvent", "PushEvent", "PushEvent"], ) @@ -614,9 +610,7 @@ def testGetKeys(self): ) def testGetOrgs(self): - self.assertListKeyEqual( - self.user.get_orgs(), lambda o: o.login, ["BeaverSoftware"] - ) + self.assertListKeyEqual(self.user.get_orgs(), lambda o: o.login, ["BeaverSoftware"]) def testGetRepos(self): self.assertListKeyEqual( @@ -664,6 +658,30 @@ def testCreateFork(self): repo = self.user.create_fork(self.g.get_user("nvie").get_repo("gitflow")) self.assertEqual(repo.source.full_name, "nvie/gitflow") + def testCreateRepoFromTemplate(self): + template_repo = self.g.get_repo("actions/hello-world-docker-action") + + repo = self.user.create_repo_from_template("hello-world-docker-action-new", template_repo) + self.assertEqual( + repo.url, + "https://api.github.com/repos/jacquev6/hello-world-docker-action-new", + ) + self.assertFalse(repo.is_template) + + def testCreateRepoFromTemplateWithAllArguments(self): + template_repo = self.g.get_repo("actions/hello-world-docker-action") + + description = "My repo from template" + private = True + repo = self.user.create_repo_from_template( + "hello-world-docker-action-new", + template_repo, + description=description, + private=private, + ) + self.assertEqual(repo.description, description) + self.assertTrue(repo.private) + def testGetNotification(self): notification = self.user.get_notification("8406712") self.assertEqual(notification.id, "8406712") @@ -672,9 +690,7 @@ def testGetNotification(self): self.assertEqual(notification.subject.title, "Feature/coveralls") self.assertEqual(notification.subject.type, "PullRequest") self.assertEqual(notification.repository.id, 8432784) - self.assertEqual( - notification.updated_at, datetime.datetime(2013, 3, 15, 5, 43, 11) - ) + self.assertEqual(notification.updated_at, datetime.datetime(2013, 3, 15, 5, 43, 11)) self.assertEqual(notification.url, None) self.assertEqual(notification.subject.url, None) self.assertEqual(notification.subject.latest_comment_url, None) @@ -692,14 +708,10 @@ def testGetNotifications(self): ) def testGetNotificationsWithOtherArguments(self): - self.assertListKeyEqual( - self.user.get_notifications(all=True), lambda n: n.id, [] - ) + self.assertListKeyEqual(self.user.get_notifications(all=True), lambda n: n.id, []) def testMarkNotificationsAsRead(self): - self.user.mark_notifications_as_read( - datetime.datetime(2018, 10, 18, 18, 20, 0o1, 0) - ) + self.user.mark_notifications_as_read(datetime.datetime(2018, 10, 18, 18, 20, 0o1, 0)) def testGetTeams(self): self.assertListKeyEqual( @@ -733,18 +745,14 @@ def testGetInvitations(self): invitation.url, "https://api.github.com/user/repository_invitations/17285388", ) - self.assertEqual( - invitation.html_url, "https://github.com/jacquev6/PyGithub/invitations" - ) + self.assertEqual(invitation.html_url, "https://github.com/jacquev6/PyGithub/invitations") self.assertEqual(invitation.repository.name, "PyGithub") self.assertEqual(invitation.invitee.login, "foobar-test1") self.assertEqual(invitation.inviter.login, "jacquev6") def testCreateMigration(self): self.assertTrue( - isinstance( - self.user.create_migration(["sample-repo"]), github.Migration.Migration - ) + isinstance(self.user.create_migration(["sample-repo"]), github.Migration.Migration) ) def testGetMigrations(self): diff --git a/tests/Organization.py b/tests/Organization.py index 40a3483291..b24487a550 100644 --- a/tests/Organization.py +++ b/tests/Organization.py @@ -357,6 +357,33 @@ def testCreateFork(self): self.assertFalse(repo.has_wiki) self.assertFalse(repo.has_pages) + + def testCreateRepoFromTemplate(self): + template_repo = self.g.get_repo("actions/hello-world-docker-action") + + repo = self.org.create_repo_from_template( + "hello-world-docker-action-new", template_repo + ) + self.assertEqual( + repo.url, + "https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new", + ) + self.assertFalse(repo.is_template) + + def testCreateRepoFromTemplateWithAllArguments(self): + template_repo = self.g.get_repo("actions/hello-world-docker-action") + + description = "My repo from template" + private = True + repo = self.org.create_repo_from_template( + "hello-world-docker-action-new", + template_repo, + description=description, + private=private, + ) + self.assertEqual(repo.description, description) + self.assertTrue(repo.private) + @mock.patch("github.PublicKey.encrypt") def testCreateSecret(self, encrypt): # encrypt returns a non-deterministic value, we need to mock it so the replay data matches diff --git a/tests/ReplayData/AuthenticatedUser.testCreateRepoFromTemplate.txt b/tests/ReplayData/AuthenticatedUser.testCreateRepoFromTemplate.txt new file mode 100644 index 0000000000..3ab48b9c2e --- /dev/null +++ b/tests/ReplayData/AuthenticatedUser.testCreateRepoFromTemplate.txt @@ -0,0 +1,33 @@ +https +GET +api.github.com +None +/repos/actions/hello-world-docker-action +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Server', 'GitHub.com'), ('Date', 'Tue, 11 Feb 2020 16:56:45 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Status', '200 OK'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4997'), ('X-RateLimit-Reset', '1581443569'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept'), ('ETag', 'W/"63c75e6c241c8aa34fa31eaac3091d88"'), ('Last-Modified', 'Fri, 07 Feb 2020 09:28:27 GMT'), ('X-OAuth-Scopes', 'public_repo, read:org, read:user, user:email'), ('X-Accepted-OAuth-Scopes', 'repo'), ('X-GitHub-Media-Type', 'github.v3; format=json'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type'), ('Access-Control-Allow-Origin', '*'), ('Strict-Transport-Security', 'max-age=31536000; includeSubdomains; preload'), ('X-Frame-Options', 'deny'), ('X-Content-Type-Options', 'nosniff'), ('X-XSS-Protection', '1; mode=block'), ('Referrer-Policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('Content-Security-Policy', "default-src 'none'"), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', '5200:6A2A:85CA2:FC534:5E42DCCD')] +{"id":200448202,"node_id":"MDEwOlJlcG9zaXRvcnkyMDA0NDgyMDI=","name":"hello-world-docker-action","full_name":"actions/hello-world-docker-action","private":false,"owner":{"login":"actions","id":44036562,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ0MDM2NTYy","avatar_url":"https://avatars1.githubusercontent.com/u/44036562?v=4","gravatar_id":"","url":"https://api.github.com/users/actions","html_url":"https://github.com/actions","followers_url":"https://api.github.com/users/actions/followers","following_url":"https://api.github.com/users/actions/following{/other_user}","gists_url":"https://api.github.com/users/actions/gists{/gist_id}","starred_url":"https://api.github.com/users/actions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/actions/subscriptions","organizations_url":"https://api.github.com/users/actions/orgs","repos_url":"https://api.github.com/users/actions/repos","events_url":"https://api.github.com/users/actions/events{/privacy}","received_events_url":"https://api.github.com/users/actions/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/actions/hello-world-docker-action","description":"A template to demonstrate how to build a Docker action.","fork":false,"url":"https://api.github.com/repos/actions/hello-world-docker-action","forks_url":"https://api.github.com/repos/actions/hello-world-docker-action/forks","keys_url":"https://api.github.com/repos/actions/hello-world-docker-action/keys{/key_id}","collaborators_url":"https://api.github.com/repos/actions/hello-world-docker-action/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/actions/hello-world-docker-action/teams","hooks_url":"https://api.github.com/repos/actions/hello-world-docker-action/hooks","issue_events_url":"https://api.github.com/repos/actions/hello-world-docker-action/issues/events{/number}","events_url":"https://api.github.com/repos/actions/hello-world-docker-action/events","assignees_url":"https://api.github.com/repos/actions/hello-world-docker-action/assignees{/user}","branches_url":"https://api.github.com/repos/actions/hello-world-docker-action/branches{/branch}","tags_url":"https://api.github.com/repos/actions/hello-world-docker-action/tags","blobs_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/refs{/sha}","trees_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/trees{/sha}","statuses_url":"https://api.github.com/repos/actions/hello-world-docker-action/statuses/{sha}","languages_url":"https://api.github.com/repos/actions/hello-world-docker-action/languages","stargazers_url":"https://api.github.com/repos/actions/hello-world-docker-action/stargazers","contributors_url":"https://api.github.com/repos/actions/hello-world-docker-action/contributors","subscribers_url":"https://api.github.com/repos/actions/hello-world-docker-action/subscribers","subscription_url":"https://api.github.com/repos/actions/hello-world-docker-action/subscription","commits_url":"https://api.github.com/repos/actions/hello-world-docker-action/commits{/sha}","git_commits_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/commits{/sha}","comments_url":"https://api.github.com/repos/actions/hello-world-docker-action/comments{/number}","issue_comment_url":"https://api.github.com/repos/actions/hello-world-docker-action/issues/comments{/number}","contents_url":"https://api.github.com/repos/actions/hello-world-docker-action/contents/{+path}","compare_url":"https://api.github.com/repos/actions/hello-world-docker-action/compare/{base}...{head}","merges_url":"https://api.github.com/repos/actions/hello-world-docker-action/merges","archive_url":"https://api.github.com/repos/actions/hello-world-docker-action/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/actions/hello-world-docker-action/downloads","issues_url":"https://api.github.com/repos/actions/hello-world-docker-action/issues{/number}","pulls_url":"https://api.github.com/repos/actions/hello-world-docker-action/pulls{/number}","milestones_url":"https://api.github.com/repos/actions/hello-world-docker-action/milestones{/number}","notifications_url":"https://api.github.com/repos/actions/hello-world-docker-action/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/actions/hello-world-docker-action/labels{/name}","releases_url":"https://api.github.com/repos/actions/hello-world-docker-action/releases{/id}","deployments_url":"https://api.github.com/repos/actions/hello-world-docker-action/deployments","created_at":"2019-08-04T04:10:12Z","updated_at":"2020-02-07T09:28:27Z","pushed_at":"2020-01-17T19:48:23Z","git_url":"git://github.com/actions/hello-world-docker-action.git","ssh_url":"git@github.com:actions/hello-world-docker-action.git","clone_url":"https://github.com/actions/hello-world-docker-action.git","svn_url":"https://github.com/actions/hello-world-docker-action","homepage":"https://help.github.com/en/articles/creating-a-docker-container-action","size":11,"stargazers_count":26,"watchers_count":26,"language":"Dockerfile","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":30,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":30,"open_issues":1,"watchers":26,"default_branch":"master","permissions":{"admin":false,"push":false,"pull":true},"temp_clone_token":"","organization":{"login":"actions","id":44036562,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ0MDM2NTYy","avatar_url":"https://avatars1.githubusercontent.com/u/44036562?v=4","gravatar_id":"","url":"https://api.github.com/users/actions","html_url":"https://github.com/actions","followers_url":"https://api.github.com/users/actions/followers","following_url":"https://api.github.com/users/actions/following{/other_user}","gists_url":"https://api.github.com/users/actions/gists{/gist_id}","starred_url":"https://api.github.com/users/actions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/actions/subscriptions","organizations_url":"https://api.github.com/users/actions/orgs","repos_url":"https://api.github.com/users/actions/repos","events_url":"https://api.github.com/users/actions/events{/privacy}","received_events_url":"https://api.github.com/users/actions/received_events","type":"Organization","site_admin":false},"network_count":30,"subscribers_count":1} + +https +GET +api.github.com +None +/user +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4994'), ('content-length', '801'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"79f748546e5fc4492505a70de6542183"'), ('date', 'Tue, 08 May 2012 09:51:20 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"public_repos":10,"type":"User","url":"https://api.github.com/users/jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","followers":13,"bio":"","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","disk_usage":16692,"plan":{"private_repos":5,"space":614400,"name":"micro","collaborators":1},"html_url":"https://github.com/jacquev6","blog":"http://vincent-jacques.net","login":"jacquev6","email":"vincent@vincent-jacques.net","created_at":"2010-07-09T06:10:06Z","company":"Criteo","location":"Paris, France","total_private_repos":5,"public_gists":1,"following":24,"name":"Vincent Jacques","id":327146,"owned_private_repos":5,"private_gists":5,"collaborators":0,"hireable":false,"node_id":"MDQ6VXNlcjMyNzE0Ng=="} + +https +POST +api.github.com +None +/repos/actions/hello-world-docker-action/generate +{'Accept': 'application/vnd.github.baptiste-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python', 'Content-Type': 'application/json'} +{"name": "hello-world-docker-action-new", "owner": "jacquev6"} +201 +[('Server', 'GitHub.com'), ('Date', 'Tue, 11 Feb 2020 16:56:49 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Content-Length', '11775'), ('Status', '201 Created'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4995'), ('X-RateLimit-Reset', '1581443568'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept'), ('ETag', '"eabd6fce61227c57848e030e45c468c3"'), ('X-OAuth-Scopes', 'public_repo, read:org, read:user, user:email'), ('X-Accepted-OAuth-Scopes', ''), ('Location', 'https://api.github.com/repos/jacquev6/hello-world-docker-action-new'), ('X-GitHub-Media-Type', 'github.baptiste-preview; format=json'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type'), ('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-GitHub-Request-Id', '8C7A:1AEB:84521:F940F:5E42DCCE')] +{"id":239815940,"node_id":"MDEwOlJlcG9zaXRvcnkyMzk4MTU5NDA=","name":"hello-world-docker-action-new","full_name":"jacquev6/hello-world-docker-action-new","owner":{"login":"jacquev6","id":9718970,"node_id":"MDQ6VXNlcjk3MTg5NzA=","avatar_url":"https://avatars2.githubusercontent.com/u/9718970?v=4","gravatar_id":"","url":"https://api.github.com/users/jacquev6","html_url":"https://github.com/jacquev6","followers_url":"https://api.github.com/users/jacquev6/followers","following_url":"https://api.github.com/users/jacquev6/following{/other_user}","gists_url":"https://api.github.com/users/jacquev6/gists{/gist_id}","starred_url":"https://api.github.com/users/jacquev6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacquev6/subscriptions","organizations_url":"https://api.github.com/users/jacquev6/orgs","repos_url":"https://api.github.com/users/jacquev6/repos","events_url":"https://api.github.com/users/jacquev6/events{/privacy}","received_events_url":"https://api.github.com/users/jacquev6/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jacquev6/hello-world-docker-action-new","description":null,"fork":false,"url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new","forks_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/forks","keys_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/teams","hooks_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/hooks","issue_events_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/issues/events{/number}","events_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/events","assignees_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/assignees{/user}","branches_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/branches{/branch}","tags_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/tags","blobs_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/git/refs{/sha}","trees_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/statuses/{sha}","languages_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/languages","stargazers_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/stargazers","contributors_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/contributors","subscribers_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/subscribers","subscription_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/subscription","commits_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/commits{/sha}","git_commits_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/git/commits{/sha}","comments_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/comments{/number}","issue_comment_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/issues/comments{/number}","contents_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/contents/{+path}","compare_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/merges","archive_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/downloads","issues_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/issues{/number}","pulls_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/pulls{/number}","milestones_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/milestones{/number}","notifications_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/labels{/name}","releases_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/releases{/id}","deployments_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/deployments","created_at":"2020-02-11T16:56:47Z","updated_at":"2020-02-11T16:56:47Z","pushed_at":"2020-02-11T16:56:48Z","git_url":"git://github.com/jacquev6/hello-world-docker-action-new.git","ssh_url":"git@github.com:jacquev6/hello-world-docker-action-new.git","clone_url":"https://github.com/jacquev6/hello-world-docker-action-new.git","svn_url":"https://github.com/jacquev6/hello-world-docker-action-new","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master","permissions":{"pull":true,"push":true,"admin":true},"is_template":false,"template_repository":{"id":200448202,"node_id":"MDEwOlJlcG9zaXRvcnkyMDA0NDgyMDI=","name":"hello-world-docker-action","full_name":"actions/hello-world-docker-action","owner":{"login":"actions","id":44036562,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ0MDM2NTYy","avatar_url":"https://avatars1.githubusercontent.com/u/44036562?v=4","gravatar_id":"","url":"https://api.github.com/users/actions","html_url":"https://github.com/actions","followers_url":"https://api.github.com/users/actions/followers","following_url":"https://api.github.com/users/actions/following{/other_user}","gists_url":"https://api.github.com/users/actions/gists{/gist_id}","starred_url":"https://api.github.com/users/actions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/actions/subscriptions","organizations_url":"https://api.github.com/users/actions/orgs","repos_url":"https://api.github.com/users/actions/repos","events_url":"https://api.github.com/users/actions/events{/privacy}","received_events_url":"https://api.github.com/users/actions/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/actions/hello-world-docker-action","description":"A template to demonstrate how to build a Docker action.","fork":false,"url":"https://api.github.com/repos/actions/hello-world-docker-action","forks_url":"https://api.github.com/repos/actions/hello-world-docker-action/forks","keys_url":"https://api.github.com/repos/actions/hello-world-docker-action/keys{/key_id}","collaborators_url":"https://api.github.com/repos/actions/hello-world-docker-action/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/actions/hello-world-docker-action/teams","hooks_url":"https://api.github.com/repos/actions/hello-world-docker-action/hooks","issue_events_url":"https://api.github.com/repos/actions/hello-world-docker-action/issues/events{/number}","events_url":"https://api.github.com/repos/actions/hello-world-docker-action/events","assignees_url":"https://api.github.com/repos/actions/hello-world-docker-action/assignees{/user}","branches_url":"https://api.github.com/repos/actions/hello-world-docker-action/branches{/branch}","tags_url":"https://api.github.com/repos/actions/hello-world-docker-action/tags","blobs_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/refs{/sha}","trees_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/trees{/sha}","statuses_url":"https://api.github.com/repos/actions/hello-world-docker-action/statuses/{sha}","languages_url":"https://api.github.com/repos/actions/hello-world-docker-action/languages","stargazers_url":"https://api.github.com/repos/actions/hello-world-docker-action/stargazers","contributors_url":"https://api.github.com/repos/actions/hello-world-docker-action/contributors","subscribers_url":"https://api.github.com/repos/actions/hello-world-docker-action/subscribers","subscription_url":"https://api.github.com/repos/actions/hello-world-docker-action/subscription","commits_url":"https://api.github.com/repos/actions/hello-world-docker-action/commits{/sha}","git_commits_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/commits{/sha}","comments_url":"https://api.github.com/repos/actions/hello-world-docker-action/comments{/number}","issue_comment_url":"https://api.github.com/repos/actions/hello-world-docker-action/issues/comments{/number}","contents_url":"https://api.github.com/repos/actions/hello-world-docker-action/contents/{+path}","compare_url":"https://api.github.com/repos/actions/hello-world-docker-action/compare/{base}...{head}","merges_url":"https://api.github.com/repos/actions/hello-world-docker-action/merges","archive_url":"https://api.github.com/repos/actions/hello-world-docker-action/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/actions/hello-world-docker-action/downloads","issues_url":"https://api.github.com/repos/actions/hello-world-docker-action/issues{/number}","pulls_url":"https://api.github.com/repos/actions/hello-world-docker-action/pulls{/number}","milestones_url":"https://api.github.com/repos/actions/hello-world-docker-action/milestones{/number}","notifications_url":"https://api.github.com/repos/actions/hello-world-docker-action/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/actions/hello-world-docker-action/labels{/name}","releases_url":"https://api.github.com/repos/actions/hello-world-docker-action/releases{/id}","deployments_url":"https://api.github.com/repos/actions/hello-world-docker-action/deployments","created_at":"2019-08-04T04:10:12Z","updated_at":"2020-02-07T09:28:27Z","pushed_at":"2020-01-17T19:48:23Z","git_url":"git://github.com/actions/hello-world-docker-action.git","ssh_url":"git@github.com:actions/hello-world-docker-action.git","clone_url":"https://github.com/actions/hello-world-docker-action.git","svn_url":"https://github.com/actions/hello-world-docker-action","homepage":"https://help.github.com/en/articles/creating-a-docker-container-action","size":11,"stargazers_count":26,"watchers_count":26,"language":"Dockerfile","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":30,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":30,"open_issues":1,"watchers":26,"default_branch":"master","permissions":{"pull":true,"push":false,"admin":false},"is_template":true},"subscribers_count":1,"network_count":1} + diff --git a/tests/ReplayData/AuthenticatedUser.testCreateRepoFromTemplateWithAllArguments.txt b/tests/ReplayData/AuthenticatedUser.testCreateRepoFromTemplateWithAllArguments.txt new file mode 100644 index 0000000000..13bbac4fb8 --- /dev/null +++ b/tests/ReplayData/AuthenticatedUser.testCreateRepoFromTemplateWithAllArguments.txt @@ -0,0 +1,33 @@ +https +GET +api.github.com +None +/repos/actions/hello-world-docker-action +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Server', 'GitHub.com'), ('Date', 'Tue, 11 Feb 2020 19:18:56 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Status', '200 OK'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4996'), ('X-RateLimit-Reset', '1581452316'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept'), ('ETag', 'W/"63c75e6c241c8aa34fa31eaac3091d88"'), ('Last-Modified', 'Fri, 07 Feb 2020 09:28:27 GMT'), ('X-OAuth-Scopes', 'public_repo, read:org, read:user, user:email'), ('X-Accepted-OAuth-Scopes', 'repo'), ('X-GitHub-Media-Type', 'github.v3; format=json'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type'), ('Access-Control-Allow-Origin', '*'), ('Strict-Transport-Security', 'max-age=31536000; includeSubdomains; preload'), ('X-Frame-Options', 'deny'), ('X-Content-Type-Options', 'nosniff'), ('X-XSS-Protection', '1; mode=block'), ('Referrer-Policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('Content-Security-Policy', "default-src 'none'"), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', '1BD6:14E8:BA6CC:1C4CAD:5E42FE20')] +{"id":200448202,"node_id":"MDEwOlJlcG9zaXRvcnkyMDA0NDgyMDI=","name":"hello-world-docker-action","full_name":"actions/hello-world-docker-action","private":false,"owner":{"login":"actions","id":44036562,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ0MDM2NTYy","avatar_url":"https://avatars1.githubusercontent.com/u/44036562?v=4","gravatar_id":"","url":"https://api.github.com/users/actions","html_url":"https://github.com/actions","followers_url":"https://api.github.com/users/actions/followers","following_url":"https://api.github.com/users/actions/following{/other_user}","gists_url":"https://api.github.com/users/actions/gists{/gist_id}","starred_url":"https://api.github.com/users/actions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/actions/subscriptions","organizations_url":"https://api.github.com/users/actions/orgs","repos_url":"https://api.github.com/users/actions/repos","events_url":"https://api.github.com/users/actions/events{/privacy}","received_events_url":"https://api.github.com/users/actions/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/actions/hello-world-docker-action","description":"A template to demonstrate how to build a Docker action.","fork":false,"url":"https://api.github.com/repos/actions/hello-world-docker-action","forks_url":"https://api.github.com/repos/actions/hello-world-docker-action/forks","keys_url":"https://api.github.com/repos/actions/hello-world-docker-action/keys{/key_id}","collaborators_url":"https://api.github.com/repos/actions/hello-world-docker-action/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/actions/hello-world-docker-action/teams","hooks_url":"https://api.github.com/repos/actions/hello-world-docker-action/hooks","issue_events_url":"https://api.github.com/repos/actions/hello-world-docker-action/issues/events{/number}","events_url":"https://api.github.com/repos/actions/hello-world-docker-action/events","assignees_url":"https://api.github.com/repos/actions/hello-world-docker-action/assignees{/user}","branches_url":"https://api.github.com/repos/actions/hello-world-docker-action/branches{/branch}","tags_url":"https://api.github.com/repos/actions/hello-world-docker-action/tags","blobs_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/refs{/sha}","trees_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/trees{/sha}","statuses_url":"https://api.github.com/repos/actions/hello-world-docker-action/statuses/{sha}","languages_url":"https://api.github.com/repos/actions/hello-world-docker-action/languages","stargazers_url":"https://api.github.com/repos/actions/hello-world-docker-action/stargazers","contributors_url":"https://api.github.com/repos/actions/hello-world-docker-action/contributors","subscribers_url":"https://api.github.com/repos/actions/hello-world-docker-action/subscribers","subscription_url":"https://api.github.com/repos/actions/hello-world-docker-action/subscription","commits_url":"https://api.github.com/repos/actions/hello-world-docker-action/commits{/sha}","git_commits_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/commits{/sha}","comments_url":"https://api.github.com/repos/actions/hello-world-docker-action/comments{/number}","issue_comment_url":"https://api.github.com/repos/actions/hello-world-docker-action/issues/comments{/number}","contents_url":"https://api.github.com/repos/actions/hello-world-docker-action/contents/{+path}","compare_url":"https://api.github.com/repos/actions/hello-world-docker-action/compare/{base}...{head}","merges_url":"https://api.github.com/repos/actions/hello-world-docker-action/merges","archive_url":"https://api.github.com/repos/actions/hello-world-docker-action/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/actions/hello-world-docker-action/downloads","issues_url":"https://api.github.com/repos/actions/hello-world-docker-action/issues{/number}","pulls_url":"https://api.github.com/repos/actions/hello-world-docker-action/pulls{/number}","milestones_url":"https://api.github.com/repos/actions/hello-world-docker-action/milestones{/number}","notifications_url":"https://api.github.com/repos/actions/hello-world-docker-action/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/actions/hello-world-docker-action/labels{/name}","releases_url":"https://api.github.com/repos/actions/hello-world-docker-action/releases{/id}","deployments_url":"https://api.github.com/repos/actions/hello-world-docker-action/deployments","created_at":"2019-08-04T04:10:12Z","updated_at":"2020-02-07T09:28:27Z","pushed_at":"2020-01-17T19:48:23Z","git_url":"git://github.com/actions/hello-world-docker-action.git","ssh_url":"git@github.com:actions/hello-world-docker-action.git","clone_url":"https://github.com/actions/hello-world-docker-action.git","svn_url":"https://github.com/actions/hello-world-docker-action","homepage":"https://help.github.com/en/articles/creating-a-docker-container-action","size":11,"stargazers_count":26,"watchers_count":26,"language":"Dockerfile","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":30,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":30,"open_issues":1,"watchers":26,"default_branch":"master","permissions":{"admin":false,"push":false,"pull":true},"temp_clone_token":"","organization":{"login":"actions","id":44036562,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ0MDM2NTYy","avatar_url":"https://avatars1.githubusercontent.com/u/44036562?v=4","gravatar_id":"","url":"https://api.github.com/users/actions","html_url":"https://github.com/actions","followers_url":"https://api.github.com/users/actions/followers","following_url":"https://api.github.com/users/actions/following{/other_user}","gists_url":"https://api.github.com/users/actions/gists{/gist_id}","starred_url":"https://api.github.com/users/actions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/actions/subscriptions","organizations_url":"https://api.github.com/users/actions/orgs","repos_url":"https://api.github.com/users/actions/repos","events_url":"https://api.github.com/users/actions/events{/privacy}","received_events_url":"https://api.github.com/users/actions/received_events","type":"Organization","site_admin":false},"network_count":30,"subscribers_count":1} + +https +GET +api.github.com +None +/user +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4994'), ('content-length', '801'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"79f748546e5fc4492505a70de6542183"'), ('date', 'Tue, 08 May 2012 09:51:20 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"public_repos":10,"type":"User","url":"https://api.github.com/users/jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","followers":13,"bio":"","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","disk_usage":16692,"plan":{"private_repos":5,"space":614400,"name":"micro","collaborators":1},"html_url":"https://github.com/jacquev6","blog":"http://vincent-jacques.net","login":"jacquev6","email":"vincent@vincent-jacques.net","created_at":"2010-07-09T06:10:06Z","company":"Criteo","location":"Paris, France","total_private_repos":5,"public_gists":1,"following":24,"name":"Vincent Jacques","id":327146,"owned_private_repos":5,"private_gists":5,"collaborators":0,"hireable":false,"node_id":"MDQ6VXNlcjMyNzE0Ng=="} + +https +POST +api.github.com +None +/repos/actions/hello-world-docker-action/generate +{'Accept': 'application/vnd.github.baptiste-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python', 'Content-Type': 'application/json'} +{"name": "hello-world-docker-action-new", "owner": "jacquev6", "description": "My repo from template", "private": true} +201 +[('Server', 'GitHub.com'), ('Date', 'Tue, 11 Feb 2020 19:18:59 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Content-Length', '11794'), ('Status', '201 Created'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4994'), ('X-RateLimit-Reset', '1581452316'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept'), ('ETag', '"7fe9f51a711de4ffab9b930e33e3d875"'), ('X-OAuth-Scopes', 'public_repo, read:org, read:user, user:email'), ('X-Accepted-OAuth-Scopes', ''), ('Location', 'https://api.github.com/repos/jacquev6/hello-world-docker-action-new'), ('X-GitHub-Media-Type', 'github.baptiste-preview; format=json'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type'), ('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-GitHub-Request-Id', '3FB4:2492:632B7:FC388:5E42FE21')] +{"id":239844699,"node_id":"MDEwOlJlcG9zaXRvcnkyMzk4NDQ2OTk=","name":"hello-world-docker-action-new","full_name":"jacquev6/hello-world-docker-action-new","owner":{"login":"jacquev6","id":9718970,"node_id":"MDQ6VXNlcjk3MTg5NzA=","avatar_url":"https://avatars2.githubusercontent.com/u/9718970?v=4","gravatar_id":"","url":"https://api.github.com/users/jacquev6","html_url":"https://github.com/jacquev6","followers_url":"https://api.github.com/users/jacquev6/followers","following_url":"https://api.github.com/users/jacquev6/following{/other_user}","gists_url":"https://api.github.com/users/jacquev6/gists{/gist_id}","starred_url":"https://api.github.com/users/jacquev6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacquev6/subscriptions","organizations_url":"https://api.github.com/users/jacquev6/orgs","repos_url":"https://api.github.com/users/jacquev6/repos","events_url":"https://api.github.com/users/jacquev6/events{/privacy}","received_events_url":"https://api.github.com/users/jacquev6/received_events","type":"User","site_admin":false},"private":true,"html_url":"https://github.com/jacquev6/hello-world-docker-action-new","description":"My repo from template","fork":false,"url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new","forks_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/forks","keys_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/teams","hooks_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/hooks","issue_events_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/issues/events{/number}","events_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/events","assignees_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/assignees{/user}","branches_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/branches{/branch}","tags_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/tags","blobs_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/git/refs{/sha}","trees_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/statuses/{sha}","languages_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/languages","stargazers_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/stargazers","contributors_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/contributors","subscribers_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/subscribers","subscription_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/subscription","commits_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/commits{/sha}","git_commits_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/git/commits{/sha}","comments_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/comments{/number}","issue_comment_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/issues/comments{/number}","contents_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/contents/{+path}","compare_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/merges","archive_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/downloads","issues_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/issues{/number}","pulls_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/pulls{/number}","milestones_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/milestones{/number}","notifications_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/labels{/name}","releases_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/releases{/id}","deployments_url":"https://api.github.com/repos/jacquev6/hello-world-docker-action-new/deployments","created_at":"2020-02-11T19:18:57Z","updated_at":"2020-02-11T19:18:57Z","pushed_at":"2020-02-11T19:18:59Z","git_url":"git://github.com/jacquev6/hello-world-docker-action-new.git","ssh_url":"git@github.com:jacquev6/hello-world-docker-action-new.git","clone_url":"https://github.com/jacquev6/hello-world-docker-action-new.git","svn_url":"https://github.com/jacquev6/hello-world-docker-action-new","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master","permissions":{"pull":true,"push":true,"admin":true},"is_template":false,"template_repository":{"id":200448202,"node_id":"MDEwOlJlcG9zaXRvcnkyMDA0NDgyMDI=","name":"hello-world-docker-action","full_name":"actions/hello-world-docker-action","owner":{"login":"actions","id":44036562,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ0MDM2NTYy","avatar_url":"https://avatars1.githubusercontent.com/u/44036562?v=4","gravatar_id":"","url":"https://api.github.com/users/actions","html_url":"https://github.com/actions","followers_url":"https://api.github.com/users/actions/followers","following_url":"https://api.github.com/users/actions/following{/other_user}","gists_url":"https://api.github.com/users/actions/gists{/gist_id}","starred_url":"https://api.github.com/users/actions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/actions/subscriptions","organizations_url":"https://api.github.com/users/actions/orgs","repos_url":"https://api.github.com/users/actions/repos","events_url":"https://api.github.com/users/actions/events{/privacy}","received_events_url":"https://api.github.com/users/actions/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/actions/hello-world-docker-action","description":"A template to demonstrate how to build a Docker action.","fork":false,"url":"https://api.github.com/repos/actions/hello-world-docker-action","forks_url":"https://api.github.com/repos/actions/hello-world-docker-action/forks","keys_url":"https://api.github.com/repos/actions/hello-world-docker-action/keys{/key_id}","collaborators_url":"https://api.github.com/repos/actions/hello-world-docker-action/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/actions/hello-world-docker-action/teams","hooks_url":"https://api.github.com/repos/actions/hello-world-docker-action/hooks","issue_events_url":"https://api.github.com/repos/actions/hello-world-docker-action/issues/events{/number}","events_url":"https://api.github.com/repos/actions/hello-world-docker-action/events","assignees_url":"https://api.github.com/repos/actions/hello-world-docker-action/assignees{/user}","branches_url":"https://api.github.com/repos/actions/hello-world-docker-action/branches{/branch}","tags_url":"https://api.github.com/repos/actions/hello-world-docker-action/tags","blobs_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/refs{/sha}","trees_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/trees{/sha}","statuses_url":"https://api.github.com/repos/actions/hello-world-docker-action/statuses/{sha}","languages_url":"https://api.github.com/repos/actions/hello-world-docker-action/languages","stargazers_url":"https://api.github.com/repos/actions/hello-world-docker-action/stargazers","contributors_url":"https://api.github.com/repos/actions/hello-world-docker-action/contributors","subscribers_url":"https://api.github.com/repos/actions/hello-world-docker-action/subscribers","subscription_url":"https://api.github.com/repos/actions/hello-world-docker-action/subscription","commits_url":"https://api.github.com/repos/actions/hello-world-docker-action/commits{/sha}","git_commits_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/commits{/sha}","comments_url":"https://api.github.com/repos/actions/hello-world-docker-action/comments{/number}","issue_comment_url":"https://api.github.com/repos/actions/hello-world-docker-action/issues/comments{/number}","contents_url":"https://api.github.com/repos/actions/hello-world-docker-action/contents/{+path}","compare_url":"https://api.github.com/repos/actions/hello-world-docker-action/compare/{base}...{head}","merges_url":"https://api.github.com/repos/actions/hello-world-docker-action/merges","archive_url":"https://api.github.com/repos/actions/hello-world-docker-action/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/actions/hello-world-docker-action/downloads","issues_url":"https://api.github.com/repos/actions/hello-world-docker-action/issues{/number}","pulls_url":"https://api.github.com/repos/actions/hello-world-docker-action/pulls{/number}","milestones_url":"https://api.github.com/repos/actions/hello-world-docker-action/milestones{/number}","notifications_url":"https://api.github.com/repos/actions/hello-world-docker-action/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/actions/hello-world-docker-action/labels{/name}","releases_url":"https://api.github.com/repos/actions/hello-world-docker-action/releases{/id}","deployments_url":"https://api.github.com/repos/actions/hello-world-docker-action/deployments","created_at":"2019-08-04T04:10:12Z","updated_at":"2020-02-07T09:28:27Z","pushed_at":"2020-01-17T19:48:23Z","git_url":"git://github.com/actions/hello-world-docker-action.git","ssh_url":"git@github.com:actions/hello-world-docker-action.git","clone_url":"https://github.com/actions/hello-world-docker-action.git","svn_url":"https://github.com/actions/hello-world-docker-action","homepage":"https://help.github.com/en/articles/creating-a-docker-container-action","size":11,"stargazers_count":26,"watchers_count":26,"language":"Dockerfile","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":30,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":30,"open_issues":1,"watchers":26,"default_branch":"master","permissions":{"pull":true,"push":false,"admin":false},"is_template":true},"subscribers_count":1,"network_count":1} + diff --git a/tests/ReplayData/Organization.testCreateRepoFromTemplate.txt b/tests/ReplayData/Organization.testCreateRepoFromTemplate.txt new file mode 100644 index 0000000000..9d97746918 --- /dev/null +++ b/tests/ReplayData/Organization.testCreateRepoFromTemplate.txt @@ -0,0 +1,22 @@ +https +GET +api.github.com +None +/repos/actions/hello-world-docker-action +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Server', 'GitHub.com'), ('Date', 'Wed, 12 Feb 2020 13:54:27 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Status', '200 OK'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4998'), ('X-RateLimit-Reset', '1581519266'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept'), ('ETag', 'W/"63c75e6c241c8aa34fa31eaac3091d88"'), ('Last-Modified', 'Fri, 07 Feb 2020 09:28:27 GMT'), ('X-OAuth-Scopes', 'public_repo, read:org, read:user, user:email'), ('X-Accepted-OAuth-Scopes', 'repo'), ('X-GitHub-Media-Type', 'github.v3; format=json'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type'), ('Access-Control-Allow-Origin', '*'), ('Strict-Transport-Security', 'max-age=31536000; includeSubdomains; preload'), ('X-Frame-Options', 'deny'), ('X-Content-Type-Options', 'nosniff'), ('X-XSS-Protection', '1; mode=block'), ('Referrer-Policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('Content-Security-Policy', "default-src 'none'"), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', '4A6A:20CC:7983B:E89EF:5E440392')] +{"id":200448202,"node_id":"MDEwOlJlcG9zaXRvcnkyMDA0NDgyMDI=","name":"hello-world-docker-action","full_name":"actions/hello-world-docker-action","private":false,"owner":{"login":"actions","id":44036562,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ0MDM2NTYy","avatar_url":"https://avatars1.githubusercontent.com/u/44036562?v=4","gravatar_id":"","url":"https://api.github.com/users/actions","html_url":"https://github.com/actions","followers_url":"https://api.github.com/users/actions/followers","following_url":"https://api.github.com/users/actions/following{/other_user}","gists_url":"https://api.github.com/users/actions/gists{/gist_id}","starred_url":"https://api.github.com/users/actions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/actions/subscriptions","organizations_url":"https://api.github.com/users/actions/orgs","repos_url":"https://api.github.com/users/actions/repos","events_url":"https://api.github.com/users/actions/events{/privacy}","received_events_url":"https://api.github.com/users/actions/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/actions/hello-world-docker-action","description":"A template to demonstrate how to build a Docker action.","fork":false,"url":"https://api.github.com/repos/actions/hello-world-docker-action","forks_url":"https://api.github.com/repos/actions/hello-world-docker-action/forks","keys_url":"https://api.github.com/repos/actions/hello-world-docker-action/keys{/key_id}","collaborators_url":"https://api.github.com/repos/actions/hello-world-docker-action/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/actions/hello-world-docker-action/teams","hooks_url":"https://api.github.com/repos/actions/hello-world-docker-action/hooks","issue_events_url":"https://api.github.com/repos/actions/hello-world-docker-action/issues/events{/number}","events_url":"https://api.github.com/repos/actions/hello-world-docker-action/events","assignees_url":"https://api.github.com/repos/actions/hello-world-docker-action/assignees{/user}","branches_url":"https://api.github.com/repos/actions/hello-world-docker-action/branches{/branch}","tags_url":"https://api.github.com/repos/actions/hello-world-docker-action/tags","blobs_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/refs{/sha}","trees_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/trees{/sha}","statuses_url":"https://api.github.com/repos/actions/hello-world-docker-action/statuses/{sha}","languages_url":"https://api.github.com/repos/actions/hello-world-docker-action/languages","stargazers_url":"https://api.github.com/repos/actions/hello-world-docker-action/stargazers","contributors_url":"https://api.github.com/repos/actions/hello-world-docker-action/contributors","subscribers_url":"https://api.github.com/repos/actions/hello-world-docker-action/subscribers","subscription_url":"https://api.github.com/repos/actions/hello-world-docker-action/subscription","commits_url":"https://api.github.com/repos/actions/hello-world-docker-action/commits{/sha}","git_commits_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/commits{/sha}","comments_url":"https://api.github.com/repos/actions/hello-world-docker-action/comments{/number}","issue_comment_url":"https://api.github.com/repos/actions/hello-world-docker-action/issues/comments{/number}","contents_url":"https://api.github.com/repos/actions/hello-world-docker-action/contents/{+path}","compare_url":"https://api.github.com/repos/actions/hello-world-docker-action/compare/{base}...{head}","merges_url":"https://api.github.com/repos/actions/hello-world-docker-action/merges","archive_url":"https://api.github.com/repos/actions/hello-world-docker-action/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/actions/hello-world-docker-action/downloads","issues_url":"https://api.github.com/repos/actions/hello-world-docker-action/issues{/number}","pulls_url":"https://api.github.com/repos/actions/hello-world-docker-action/pulls{/number}","milestones_url":"https://api.github.com/repos/actions/hello-world-docker-action/milestones{/number}","notifications_url":"https://api.github.com/repos/actions/hello-world-docker-action/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/actions/hello-world-docker-action/labels{/name}","releases_url":"https://api.github.com/repos/actions/hello-world-docker-action/releases{/id}","deployments_url":"https://api.github.com/repos/actions/hello-world-docker-action/deployments","created_at":"2019-08-04T04:10:12Z","updated_at":"2020-02-07T09:28:27Z","pushed_at":"2020-01-17T19:48:23Z","git_url":"git://github.com/actions/hello-world-docker-action.git","ssh_url":"git@github.com:actions/hello-world-docker-action.git","clone_url":"https://github.com/actions/hello-world-docker-action.git","svn_url":"https://github.com/actions/hello-world-docker-action","homepage":"https://help.github.com/en/articles/creating-a-docker-container-action","size":11,"stargazers_count":26,"watchers_count":26,"language":"Dockerfile","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":30,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":30,"open_issues":1,"watchers":26,"default_branch":"master","permissions":{"admin":false,"push":false,"pull":true},"temp_clone_token":"","organization":{"login":"actions","id":44036562,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ0MDM2NTYy","avatar_url":"https://avatars1.githubusercontent.com/u/44036562?v=4","gravatar_id":"","url":"https://api.github.com/users/actions","html_url":"https://github.com/actions","followers_url":"https://api.github.com/users/actions/followers","following_url":"https://api.github.com/users/actions/following{/other_user}","gists_url":"https://api.github.com/users/actions/gists{/gist_id}","starred_url":"https://api.github.com/users/actions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/actions/subscriptions","organizations_url":"https://api.github.com/users/actions/orgs","repos_url":"https://api.github.com/users/actions/repos","events_url":"https://api.github.com/users/actions/events{/privacy}","received_events_url":"https://api.github.com/users/actions/received_events","type":"Organization","site_admin":false},"network_count":30,"subscribers_count":1} + +https +POST +api.github.com +None +/repos/actions/hello-world-docker-action/generate +{'Accept': 'application/vnd.github.baptiste-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python', 'Content-Type': 'application/json'} +{"name": "hello-world-docker-action-new", "owner": "BeaverSoftware"} +201 +[('Server', 'GitHub.com'), ('Date', 'Wed, 12 Feb 2020 13:54:29 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Content-Length', '12600'), ('Status', '201 Created'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4997'), ('X-RateLimit-Reset', '1581519266'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept'), ('ETag', '"36abdc4630fb044196d6efbfc0f644e0"'), ('X-OAuth-Scopes', 'public_repo, read:org, read:user, user:email'), ('X-Accepted-OAuth-Scopes', ''), ('Location', 'https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new'), ('X-GitHub-Media-Type', 'github.baptiste-preview; format=json'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type'), ('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-GitHub-Request-Id', '8C3C:2BF7:ACD4:17C45:5E440393')] +{"id":240025159,"node_id":"MDEwOlJlcG9zaXRvcnkyNDAwMjUxNTk=","name":"hello-world-docker-action-new","full_name":"BeaverSoftware/hello-world-docker-action-new","owner":{"login":"BeaverSoftware","id":60894054,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYwODk0MDU0","avatar_url":"https://avatars2.githubusercontent.com/u/60894054?v=4","gravatar_id":"","url":"https://api.github.com/users/BeaverSoftware","html_url":"https://github.com/BeaverSoftware","followers_url":"https://api.github.com/users/BeaverSoftware/followers","following_url":"https://api.github.com/users/BeaverSoftware/following{/other_user}","gists_url":"https://api.github.com/users/BeaverSoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/BeaverSoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BeaverSoftware/subscriptions","organizations_url":"https://api.github.com/users/BeaverSoftware/orgs","repos_url":"https://api.github.com/users/BeaverSoftware/repos","events_url":"https://api.github.com/users/BeaverSoftware/events{/privacy}","received_events_url":"https://api.github.com/users/BeaverSoftware/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/BeaverSoftware/hello-world-docker-action-new","description":null,"fork":false,"url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new","forks_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/forks","keys_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/teams","hooks_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/hooks","issue_events_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/issues/events{/number}","events_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/events","assignees_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/assignees{/user}","branches_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/branches{/branch}","tags_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/tags","blobs_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/git/refs{/sha}","trees_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/statuses/{sha}","languages_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/languages","stargazers_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/stargazers","contributors_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/contributors","subscribers_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/subscribers","subscription_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/subscription","commits_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/commits{/sha}","git_commits_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/git/commits{/sha}","comments_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/comments{/number}","issue_comment_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/issues/comments{/number}","contents_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/contents/{+path}","compare_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/merges","archive_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/downloads","issues_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/issues{/number}","pulls_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/pulls{/number}","milestones_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/milestones{/number}","notifications_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/labels{/name}","releases_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/releases{/id}","deployments_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/deployments","created_at":"2020-02-12T13:54:28Z","updated_at":"2020-02-12T13:54:28Z","pushed_at":"2020-02-12T13:54:29Z","git_url":"git://github.com/BeaverSoftware/hello-world-docker-action-new.git","ssh_url":"git@github.com:BeaverSoftware/hello-world-docker-action-new.git","clone_url":"https://github.com/BeaverSoftware/hello-world-docker-action-new.git","svn_url":"https://github.com/BeaverSoftware/hello-world-docker-action-new","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master","permissions":{"pull":true,"push":true,"admin":true},"is_template":false,"template_repository":{"id":200448202,"node_id":"MDEwOlJlcG9zaXRvcnkyMDA0NDgyMDI=","name":"hello-world-docker-action","full_name":"actions/hello-world-docker-action","owner":{"login":"actions","id":44036562,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ0MDM2NTYy","avatar_url":"https://avatars1.githubusercontent.com/u/44036562?v=4","gravatar_id":"","url":"https://api.github.com/users/actions","html_url":"https://github.com/actions","followers_url":"https://api.github.com/users/actions/followers","following_url":"https://api.github.com/users/actions/following{/other_user}","gists_url":"https://api.github.com/users/actions/gists{/gist_id}","starred_url":"https://api.github.com/users/actions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/actions/subscriptions","organizations_url":"https://api.github.com/users/actions/orgs","repos_url":"https://api.github.com/users/actions/repos","events_url":"https://api.github.com/users/actions/events{/privacy}","received_events_url":"https://api.github.com/users/actions/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/actions/hello-world-docker-action","description":"A template to demonstrate how to build a Docker action.","fork":false,"url":"https://api.github.com/repos/actions/hello-world-docker-action","forks_url":"https://api.github.com/repos/actions/hello-world-docker-action/forks","keys_url":"https://api.github.com/repos/actions/hello-world-docker-action/keys{/key_id}","collaborators_url":"https://api.github.com/repos/actions/hello-world-docker-action/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/actions/hello-world-docker-action/teams","hooks_url":"https://api.github.com/repos/actions/hello-world-docker-action/hooks","issue_events_url":"https://api.github.com/repos/actions/hello-world-docker-action/issues/events{/number}","events_url":"https://api.github.com/repos/actions/hello-world-docker-action/events","assignees_url":"https://api.github.com/repos/actions/hello-world-docker-action/assignees{/user}","branches_url":"https://api.github.com/repos/actions/hello-world-docker-action/branches{/branch}","tags_url":"https://api.github.com/repos/actions/hello-world-docker-action/tags","blobs_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/refs{/sha}","trees_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/trees{/sha}","statuses_url":"https://api.github.com/repos/actions/hello-world-docker-action/statuses/{sha}","languages_url":"https://api.github.com/repos/actions/hello-world-docker-action/languages","stargazers_url":"https://api.github.com/repos/actions/hello-world-docker-action/stargazers","contributors_url":"https://api.github.com/repos/actions/hello-world-docker-action/contributors","subscribers_url":"https://api.github.com/repos/actions/hello-world-docker-action/subscribers","subscription_url":"https://api.github.com/repos/actions/hello-world-docker-action/subscription","commits_url":"https://api.github.com/repos/actions/hello-world-docker-action/commits{/sha}","git_commits_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/commits{/sha}","comments_url":"https://api.github.com/repos/actions/hello-world-docker-action/comments{/number}","issue_comment_url":"https://api.github.com/repos/actions/hello-world-docker-action/issues/comments{/number}","contents_url":"https://api.github.com/repos/actions/hello-world-docker-action/contents/{+path}","compare_url":"https://api.github.com/repos/actions/hello-world-docker-action/compare/{base}...{head}","merges_url":"https://api.github.com/repos/actions/hello-world-docker-action/merges","archive_url":"https://api.github.com/repos/actions/hello-world-docker-action/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/actions/hello-world-docker-action/downloads","issues_url":"https://api.github.com/repos/actions/hello-world-docker-action/issues{/number}","pulls_url":"https://api.github.com/repos/actions/hello-world-docker-action/pulls{/number}","milestones_url":"https://api.github.com/repos/actions/hello-world-docker-action/milestones{/number}","notifications_url":"https://api.github.com/repos/actions/hello-world-docker-action/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/actions/hello-world-docker-action/labels{/name}","releases_url":"https://api.github.com/repos/actions/hello-world-docker-action/releases{/id}","deployments_url":"https://api.github.com/repos/actions/hello-world-docker-action/deployments","created_at":"2019-08-04T04:10:12Z","updated_at":"2020-02-07T09:28:27Z","pushed_at":"2020-01-17T19:48:23Z","git_url":"git://github.com/actions/hello-world-docker-action.git","ssh_url":"git@github.com:actions/hello-world-docker-action.git","clone_url":"https://github.com/actions/hello-world-docker-action.git","svn_url":"https://github.com/actions/hello-world-docker-action","homepage":"https://help.github.com/en/articles/creating-a-docker-container-action","size":11,"stargazers_count":26,"watchers_count":26,"language":"Dockerfile","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":30,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":30,"open_issues":1,"watchers":26,"default_branch":"master","permissions":{"pull":true,"push":false,"admin":false},"is_template":true},"organization":{"login":"BeaverSoftware","id":60894054,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYwODk0MDU0","avatar_url":"https://avatars2.githubusercontent.com/u/60894054?v=4","gravatar_id":"","url":"https://api.github.com/users/BeaverSoftware","html_url":"https://github.com/BeaverSoftware","followers_url":"https://api.github.com/users/BeaverSoftware/followers","following_url":"https://api.github.com/users/BeaverSoftware/following{/other_user}","gists_url":"https://api.github.com/users/BeaverSoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/BeaverSoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BeaverSoftware/subscriptions","organizations_url":"https://api.github.com/users/BeaverSoftware/orgs","repos_url":"https://api.github.com/users/BeaverSoftware/repos","events_url":"https://api.github.com/users/BeaverSoftware/events{/privacy}","received_events_url":"https://api.github.com/users/BeaverSoftware/received_events","type":"Organization","site_admin":false},"subscribers_count":0,"network_count":1} + diff --git a/tests/ReplayData/Organization.testCreateRepoFromTemplateWithAllArguments.txt b/tests/ReplayData/Organization.testCreateRepoFromTemplateWithAllArguments.txt new file mode 100644 index 0000000000..8e45505ef5 --- /dev/null +++ b/tests/ReplayData/Organization.testCreateRepoFromTemplateWithAllArguments.txt @@ -0,0 +1,22 @@ +https +GET +api.github.com +None +/repos/actions/hello-world-docker-action +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Server', 'GitHub.com'), ('Date', 'Wed, 12 Feb 2020 18:18:10 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Status', '200 OK'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4992'), ('X-RateLimit-Reset', '1581534987'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept'), ('ETag', 'W/"63c75e6c241c8aa34fa31eaac3091d88"'), ('Last-Modified', 'Fri, 07 Feb 2020 09:28:27 GMT'), ('X-OAuth-Scopes', 'public_repo, read:org, read:user, user:email'), ('X-Accepted-OAuth-Scopes', 'repo'), ('X-GitHub-Media-Type', 'github.v3; format=json'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type'), ('Access-Control-Allow-Origin', '*'), ('Strict-Transport-Security', 'max-age=31536000; includeSubdomains; preload'), ('X-Frame-Options', 'deny'), ('X-Content-Type-Options', 'nosniff'), ('X-XSS-Protection', '1; mode=block'), ('Referrer-Policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('Content-Security-Policy', "default-src 'none'"), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', '41AB:41D3:1FFAAB:3C0DBC:5E444162')] +{"id":200448202,"node_id":"MDEwOlJlcG9zaXRvcnkyMDA0NDgyMDI=","name":"hello-world-docker-action","full_name":"actions/hello-world-docker-action","private":false,"owner":{"login":"actions","id":44036562,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ0MDM2NTYy","avatar_url":"https://avatars1.githubusercontent.com/u/44036562?v=4","gravatar_id":"","url":"https://api.github.com/users/actions","html_url":"https://github.com/actions","followers_url":"https://api.github.com/users/actions/followers","following_url":"https://api.github.com/users/actions/following{/other_user}","gists_url":"https://api.github.com/users/actions/gists{/gist_id}","starred_url":"https://api.github.com/users/actions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/actions/subscriptions","organizations_url":"https://api.github.com/users/actions/orgs","repos_url":"https://api.github.com/users/actions/repos","events_url":"https://api.github.com/users/actions/events{/privacy}","received_events_url":"https://api.github.com/users/actions/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/actions/hello-world-docker-action","description":"A template to demonstrate how to build a Docker action.","fork":false,"url":"https://api.github.com/repos/actions/hello-world-docker-action","forks_url":"https://api.github.com/repos/actions/hello-world-docker-action/forks","keys_url":"https://api.github.com/repos/actions/hello-world-docker-action/keys{/key_id}","collaborators_url":"https://api.github.com/repos/actions/hello-world-docker-action/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/actions/hello-world-docker-action/teams","hooks_url":"https://api.github.com/repos/actions/hello-world-docker-action/hooks","issue_events_url":"https://api.github.com/repos/actions/hello-world-docker-action/issues/events{/number}","events_url":"https://api.github.com/repos/actions/hello-world-docker-action/events","assignees_url":"https://api.github.com/repos/actions/hello-world-docker-action/assignees{/user}","branches_url":"https://api.github.com/repos/actions/hello-world-docker-action/branches{/branch}","tags_url":"https://api.github.com/repos/actions/hello-world-docker-action/tags","blobs_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/refs{/sha}","trees_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/trees{/sha}","statuses_url":"https://api.github.com/repos/actions/hello-world-docker-action/statuses/{sha}","languages_url":"https://api.github.com/repos/actions/hello-world-docker-action/languages","stargazers_url":"https://api.github.com/repos/actions/hello-world-docker-action/stargazers","contributors_url":"https://api.github.com/repos/actions/hello-world-docker-action/contributors","subscribers_url":"https://api.github.com/repos/actions/hello-world-docker-action/subscribers","subscription_url":"https://api.github.com/repos/actions/hello-world-docker-action/subscription","commits_url":"https://api.github.com/repos/actions/hello-world-docker-action/commits{/sha}","git_commits_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/commits{/sha}","comments_url":"https://api.github.com/repos/actions/hello-world-docker-action/comments{/number}","issue_comment_url":"https://api.github.com/repos/actions/hello-world-docker-action/issues/comments{/number}","contents_url":"https://api.github.com/repos/actions/hello-world-docker-action/contents/{+path}","compare_url":"https://api.github.com/repos/actions/hello-world-docker-action/compare/{base}...{head}","merges_url":"https://api.github.com/repos/actions/hello-world-docker-action/merges","archive_url":"https://api.github.com/repos/actions/hello-world-docker-action/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/actions/hello-world-docker-action/downloads","issues_url":"https://api.github.com/repos/actions/hello-world-docker-action/issues{/number}","pulls_url":"https://api.github.com/repos/actions/hello-world-docker-action/pulls{/number}","milestones_url":"https://api.github.com/repos/actions/hello-world-docker-action/milestones{/number}","notifications_url":"https://api.github.com/repos/actions/hello-world-docker-action/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/actions/hello-world-docker-action/labels{/name}","releases_url":"https://api.github.com/repos/actions/hello-world-docker-action/releases{/id}","deployments_url":"https://api.github.com/repos/actions/hello-world-docker-action/deployments","created_at":"2019-08-04T04:10:12Z","updated_at":"2020-02-07T09:28:27Z","pushed_at":"2020-01-17T19:48:23Z","git_url":"git://github.com/actions/hello-world-docker-action.git","ssh_url":"git@github.com:actions/hello-world-docker-action.git","clone_url":"https://github.com/actions/hello-world-docker-action.git","svn_url":"https://github.com/actions/hello-world-docker-action","homepage":"https://help.github.com/en/articles/creating-a-docker-container-action","size":11,"stargazers_count":26,"watchers_count":26,"language":"Dockerfile","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":30,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":30,"open_issues":1,"watchers":26,"default_branch":"master","permissions":{"admin":false,"push":false,"pull":true},"temp_clone_token":"","organization":{"login":"actions","id":44036562,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ0MDM2NTYy","avatar_url":"https://avatars1.githubusercontent.com/u/44036562?v=4","gravatar_id":"","url":"https://api.github.com/users/actions","html_url":"https://github.com/actions","followers_url":"https://api.github.com/users/actions/followers","following_url":"https://api.github.com/users/actions/following{/other_user}","gists_url":"https://api.github.com/users/actions/gists{/gist_id}","starred_url":"https://api.github.com/users/actions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/actions/subscriptions","organizations_url":"https://api.github.com/users/actions/orgs","repos_url":"https://api.github.com/users/actions/repos","events_url":"https://api.github.com/users/actions/events{/privacy}","received_events_url":"https://api.github.com/users/actions/received_events","type":"Organization","site_admin":false},"network_count":30,"subscribers_count":1} + +https +POST +api.github.com +None +/repos/actions/hello-world-docker-action/generate +{'Accept': 'application/vnd.github.baptiste-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python', 'Content-Type': 'application/json'} +{"name": "hello-world-docker-action-new", "owner": "BeaverSoftware", "description": "My repo from template", "private": true} +201 +[('Server', 'GitHub.com'), ('Date', 'Wed, 12 Feb 2020 18:18:12 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Content-Length', '12619'), ('Status', '201 Created'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4991'), ('X-RateLimit-Reset', '1581534987'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept'), ('ETag', '"7ab10890a25b4661a4310dc8dbf4491f"'), ('X-OAuth-Scopes', 'public_repo, read:org, read:user, user:email'), ('X-Accepted-OAuth-Scopes', ''), ('Location', 'https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new'), ('X-GitHub-Media-Type', 'github.baptiste-preview; format=json'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type'), ('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-GitHub-Request-Id', 'C35C:1792:11E12C:2D04D2:5E444162')] +{"id":240083127,"node_id":"MDEwOlJlcG9zaXRvcnkyNDAwODMxMjc=","name":"hello-world-docker-action-new","full_name":"BeaverSoftware/hello-world-docker-action-new","owner":{"login":"BeaverSoftware","id":60894054,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYwODk0MDU0","avatar_url":"https://avatars2.githubusercontent.com/u/60894054?v=4","gravatar_id":"","url":"https://api.github.com/users/BeaverSoftware","html_url":"https://github.com/BeaverSoftware","followers_url":"https://api.github.com/users/BeaverSoftware/followers","following_url":"https://api.github.com/users/BeaverSoftware/following{/other_user}","gists_url":"https://api.github.com/users/BeaverSoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/BeaverSoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BeaverSoftware/subscriptions","organizations_url":"https://api.github.com/users/BeaverSoftware/orgs","repos_url":"https://api.github.com/users/BeaverSoftware/repos","events_url":"https://api.github.com/users/BeaverSoftware/events{/privacy}","received_events_url":"https://api.github.com/users/BeaverSoftware/received_events","type":"Organization","site_admin":false},"private":true,"html_url":"https://github.com/BeaverSoftware/hello-world-docker-action-new","description":"My repo from template","fork":false,"url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new","forks_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/forks","keys_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/teams","hooks_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/hooks","issue_events_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/issues/events{/number}","events_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/events","assignees_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/assignees{/user}","branches_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/branches{/branch}","tags_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/tags","blobs_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/git/refs{/sha}","trees_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/statuses/{sha}","languages_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/languages","stargazers_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/stargazers","contributors_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/contributors","subscribers_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/subscribers","subscription_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/subscription","commits_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/commits{/sha}","git_commits_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/git/commits{/sha}","comments_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/comments{/number}","issue_comment_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/issues/comments{/number}","contents_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/contents/{+path}","compare_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/merges","archive_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/downloads","issues_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/issues{/number}","pulls_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/pulls{/number}","milestones_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/milestones{/number}","notifications_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/labels{/name}","releases_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/releases{/id}","deployments_url":"https://api.github.com/repos/BeaverSoftware/hello-world-docker-action-new/deployments","created_at":"2020-02-12T18:18:11Z","updated_at":"2020-02-12T18:18:11Z","pushed_at":"2020-02-12T18:18:12Z","git_url":"git://github.com/BeaverSoftware/hello-world-docker-action-new.git","ssh_url":"git@github.com:BeaverSoftware/hello-world-docker-action-new.git","clone_url":"https://github.com/BeaverSoftware/hello-world-docker-action-new.git","svn_url":"https://github.com/BeaverSoftware/hello-world-docker-action-new","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master","permissions":{"pull":true,"push":true,"admin":true},"is_template":false,"template_repository":{"id":200448202,"node_id":"MDEwOlJlcG9zaXRvcnkyMDA0NDgyMDI=","name":"hello-world-docker-action","full_name":"actions/hello-world-docker-action","owner":{"login":"actions","id":44036562,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ0MDM2NTYy","avatar_url":"https://avatars1.githubusercontent.com/u/44036562?v=4","gravatar_id":"","url":"https://api.github.com/users/actions","html_url":"https://github.com/actions","followers_url":"https://api.github.com/users/actions/followers","following_url":"https://api.github.com/users/actions/following{/other_user}","gists_url":"https://api.github.com/users/actions/gists{/gist_id}","starred_url":"https://api.github.com/users/actions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/actions/subscriptions","organizations_url":"https://api.github.com/users/actions/orgs","repos_url":"https://api.github.com/users/actions/repos","events_url":"https://api.github.com/users/actions/events{/privacy}","received_events_url":"https://api.github.com/users/actions/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/actions/hello-world-docker-action","description":"A template to demonstrate how to build a Docker action.","fork":false,"url":"https://api.github.com/repos/actions/hello-world-docker-action","forks_url":"https://api.github.com/repos/actions/hello-world-docker-action/forks","keys_url":"https://api.github.com/repos/actions/hello-world-docker-action/keys{/key_id}","collaborators_url":"https://api.github.com/repos/actions/hello-world-docker-action/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/actions/hello-world-docker-action/teams","hooks_url":"https://api.github.com/repos/actions/hello-world-docker-action/hooks","issue_events_url":"https://api.github.com/repos/actions/hello-world-docker-action/issues/events{/number}","events_url":"https://api.github.com/repos/actions/hello-world-docker-action/events","assignees_url":"https://api.github.com/repos/actions/hello-world-docker-action/assignees{/user}","branches_url":"https://api.github.com/repos/actions/hello-world-docker-action/branches{/branch}","tags_url":"https://api.github.com/repos/actions/hello-world-docker-action/tags","blobs_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/refs{/sha}","trees_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/trees{/sha}","statuses_url":"https://api.github.com/repos/actions/hello-world-docker-action/statuses/{sha}","languages_url":"https://api.github.com/repos/actions/hello-world-docker-action/languages","stargazers_url":"https://api.github.com/repos/actions/hello-world-docker-action/stargazers","contributors_url":"https://api.github.com/repos/actions/hello-world-docker-action/contributors","subscribers_url":"https://api.github.com/repos/actions/hello-world-docker-action/subscribers","subscription_url":"https://api.github.com/repos/actions/hello-world-docker-action/subscription","commits_url":"https://api.github.com/repos/actions/hello-world-docker-action/commits{/sha}","git_commits_url":"https://api.github.com/repos/actions/hello-world-docker-action/git/commits{/sha}","comments_url":"https://api.github.com/repos/actions/hello-world-docker-action/comments{/number}","issue_comment_url":"https://api.github.com/repos/actions/hello-world-docker-action/issues/comments{/number}","contents_url":"https://api.github.com/repos/actions/hello-world-docker-action/contents/{+path}","compare_url":"https://api.github.com/repos/actions/hello-world-docker-action/compare/{base}...{head}","merges_url":"https://api.github.com/repos/actions/hello-world-docker-action/merges","archive_url":"https://api.github.com/repos/actions/hello-world-docker-action/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/actions/hello-world-docker-action/downloads","issues_url":"https://api.github.com/repos/actions/hello-world-docker-action/issues{/number}","pulls_url":"https://api.github.com/repos/actions/hello-world-docker-action/pulls{/number}","milestones_url":"https://api.github.com/repos/actions/hello-world-docker-action/milestones{/number}","notifications_url":"https://api.github.com/repos/actions/hello-world-docker-action/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/actions/hello-world-docker-action/labels{/name}","releases_url":"https://api.github.com/repos/actions/hello-world-docker-action/releases{/id}","deployments_url":"https://api.github.com/repos/actions/hello-world-docker-action/deployments","created_at":"2019-08-04T04:10:12Z","updated_at":"2020-02-07T09:28:27Z","pushed_at":"2020-01-17T19:48:23Z","git_url":"git://github.com/actions/hello-world-docker-action.git","ssh_url":"git@github.com:actions/hello-world-docker-action.git","clone_url":"https://github.com/actions/hello-world-docker-action.git","svn_url":"https://github.com/actions/hello-world-docker-action","homepage":"https://help.github.com/en/articles/creating-a-docker-container-action","size":11,"stargazers_count":26,"watchers_count":26,"language":"Dockerfile","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":30,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":30,"open_issues":1,"watchers":26,"default_branch":"master","permissions":{"pull":true,"push":false,"admin":false},"is_template":true},"organization":{"login":"BeaverSoftware","id":60894054,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYwODk0MDU0","avatar_url":"https://avatars2.githubusercontent.com/u/60894054?v=4","gravatar_id":"","url":"https://api.github.com/users/BeaverSoftware","html_url":"https://github.com/BeaverSoftware","followers_url":"https://api.github.com/users/BeaverSoftware/followers","following_url":"https://api.github.com/users/BeaverSoftware/following{/other_user}","gists_url":"https://api.github.com/users/BeaverSoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/BeaverSoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BeaverSoftware/subscriptions","organizations_url":"https://api.github.com/users/BeaverSoftware/orgs","repos_url":"https://api.github.com/users/BeaverSoftware/repos","events_url":"https://api.github.com/users/BeaverSoftware/events{/privacy}","received_events_url":"https://api.github.com/users/BeaverSoftware/received_events","type":"Organization","site_admin":false},"subscribers_count":0,"network_count":1} + diff --git a/tests/Repository.py b/tests/Repository.py index e30aa884c8..cdc78b761b 100644 --- a/tests/Repository.py +++ b/tests/Repository.py @@ -89,6 +89,7 @@ def testAttributes(self): self.assertEqual(self.repo.homepage, "http://vincent-jacques.net/PyGithub") self.assertEqual(self.repo.html_url, "https://github.com/jacquev6/PyGithub") self.assertEqual(self.repo.id, 3544490) + self.assertIs(self.repo.is_template, None) self.assertEqual(self.repo.language, "Python") self.assertEqual(self.repo.master_branch, None) self.assertEqual(self.repo.name, "PyGithub")