From 65cfeb1b8b207e3df04726f82aae49f7b9870a2a Mon Sep 17 00:00:00 2001 From: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> Date: Mon, 4 Sep 2023 09:28:01 +0200 Subject: [PATCH] Add missing attributes to `Repository` (#2742) --- github/Repository.py | 148 ++++++++++++++++-- github/Repository.pyi | 24 ++- tests/ReplayData/Repository.setUp.txt | 4 +- .../Repository.testEditWithAllArguments.txt | 6 +- tests/Repository.py | 22 ++- 5 files changed, 181 insertions(+), 23 deletions(-) diff --git a/github/Repository.py b/github/Repository.py index 6e3d2c8d..3bc81fa7 100644 --- a/github/Repository.py +++ b/github/Repository.py @@ -623,6 +623,22 @@ class Repository(github.GithubObject.CompletableGithubObject): self._completeIfNotSet(self._master_branch) return self._master_branch.value + @property + def merge_commit_message(self): + """ + :type: string + """ + self._completeIfNotSet(self._merge_commit_message) + return self._merge_commit_message.value + + @property + def merge_commit_title(self): + """ + :type: string + """ + self._completeIfNotSet(self._merge_commit_title) + return self._merge_commit_title.value + @property def merges_url(self): """ @@ -767,6 +783,22 @@ class Repository(github.GithubObject.CompletableGithubObject): self._completeIfNotSet(self._source) return self._source.value + @property + def squash_merge_commit_message(self): + """ + :type: string + """ + self._completeIfNotSet(self._squash_merge_commit_message) + return self._squash_merge_commit_message.value + + @property + def squash_merge_commit_title(self): + """ + :type: string + """ + self._completeIfNotSet(self._squash_merge_commit_title) + return self._squash_merge_commit_title.value + @property def ssh_url(self): """ @@ -879,6 +911,14 @@ class Repository(github.GithubObject.CompletableGithubObject): self._completeIfNotSet(self._url) return self._url.value + @property + def use_squash_pr_title_as_default(self): + """ + :type: bool + """ + self._completeIfNotSet(self._use_squash_pr_title_as_default) + return self._use_squash_pr_title_as_default.value + @property def visibility(self): """ @@ -903,6 +943,14 @@ class Repository(github.GithubObject.CompletableGithubObject): self._completeIfNotSet(self._watchers_count) return self._watchers_count.value + @property + def web_commit_signoff_required(self): + """ + :type: bool + """ + self._completeIfNotSet(self._web_commit_signoff_required) + return self._web_commit_signoff_required.value + def add_to_collaborators(self, collaborator, permission=github.GithubObject.NotSet): """ :calls: `PUT /repos/{owner}/{repo}/collaborators/{user} `_ @@ -1739,19 +1787,26 @@ class Repository(github.GithubObject.CompletableGithubObject): description=github.GithubObject.NotSet, homepage=github.GithubObject.NotSet, private=github.GithubObject.NotSet, + visibility=github.GithubObject.NotSet, has_issues=github.GithubObject.NotSet, has_projects=github.GithubObject.NotSet, has_wiki=github.GithubObject.NotSet, - has_downloads=github.GithubObject.NotSet, + is_template=github.GithubObject.NotSet, default_branch=github.GithubObject.NotSet, - allow_auto_merge=github.GithubObject.NotSet, - allow_forking=github.GithubObject.NotSet, allow_squash_merge=github.GithubObject.NotSet, allow_merge_commit=github.GithubObject.NotSet, allow_rebase_merge=github.GithubObject.NotSet, + allow_auto_merge=github.GithubObject.NotSet, delete_branch_on_merge=github.GithubObject.NotSet, allow_update_branch=github.GithubObject.NotSet, + use_squash_pr_title_as_default=github.GithubObject.NotSet, + squash_merge_commit_title=github.GithubObject.NotSet, + squash_merge_commit_message=github.GithubObject.NotSet, + merge_commit_title=github.GithubObject.NotSet, + merge_commit_message=github.GithubObject.NotSet, archived=github.GithubObject.NotSet, + allow_forking=github.GithubObject.NotSet, + web_commit_signoff_required=github.GithubObject.NotSet, ): """ :calls: `PATCH /repos/{owner}/{repo} `_ @@ -1759,18 +1814,26 @@ class Repository(github.GithubObject.CompletableGithubObject): :param description: string :param homepage: string :param private: bool + :param visibility: string :param has_issues: bool :param has_projects: bool :param has_wiki: bool - :param has_downloads: bool + :param is_template: bool :param default_branch: string - :param allow_forking: bool :param allow_squash_merge: bool :param allow_merge_commit: bool :param allow_rebase_merge: bool + :param allow_auto_merge: bool :param delete_branch_on_merge: bool :param allow_update_branch: bool + :param use_squash_pr_title_as_default: bool + :param squash_merge_commit_title : string + :param squash_merge_commit_message : string + :param merge_commit_title : string + :param merge_commit_message : string :param archived: bool + :param allow_forking: bool + :param web_commit_signoff_required: bool :rtype: None """ if name is None: @@ -1779,13 +1842,14 @@ class Repository(github.GithubObject.CompletableGithubObject): 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 visibility is github.GithubObject.NotSet or ( + isinstance(visibility, str) and visibility in ["public", "private"] + ), visibility assert has_issues is github.GithubObject.NotSet or isinstance(has_issues, bool), has_issues assert has_projects is github.GithubObject.NotSet or isinstance(has_projects, bool), has_projects 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 is_template is github.GithubObject.NotSet or isinstance(is_template, bool), is_template assert default_branch is github.GithubObject.NotSet or isinstance(default_branch, str), default_branch - assert allow_auto_merge is github.GithubObject.NotSet or isinstance(allow_auto_merge, bool), allow_auto_merge - assert allow_forking is github.GithubObject.NotSet or isinstance(allow_forking, bool), allow_forking assert allow_squash_merge is github.GithubObject.NotSet or isinstance( allow_squash_merge, bool ), allow_squash_merge @@ -1795,48 +1859,86 @@ class Repository(github.GithubObject.CompletableGithubObject): assert allow_rebase_merge is github.GithubObject.NotSet or isinstance( allow_rebase_merge, bool ), allow_rebase_merge + assert allow_auto_merge is github.GithubObject.NotSet or isinstance(allow_auto_merge, bool), allow_auto_merge assert delete_branch_on_merge is github.GithubObject.NotSet or isinstance( delete_branch_on_merge, bool ), delete_branch_on_merge assert allow_update_branch is github.GithubObject.NotSet or isinstance( allow_update_branch, bool ), allow_update_branch + assert use_squash_pr_title_as_default is github.GithubObject.NotSet or isinstance( + use_squash_pr_title_as_default, bool + ), use_squash_pr_title_as_default + assert squash_merge_commit_title is github.GithubObject.NotSet or ( + isinstance(squash_merge_commit_title, str) + and squash_merge_commit_title in ["PR_TITLE", "COMMIT_OR_PR_TITLE"] + ), squash_merge_commit_title + assert squash_merge_commit_message is github.GithubObject.NotSet or ( + isinstance(squash_merge_commit_message, str) + and squash_merge_commit_message in ["PR_BODY", "COMMIT_MESSAGES", "BLANK"] + ), squash_merge_commit_message + assert merge_commit_title is github.GithubObject.NotSet or ( + isinstance(merge_commit_title, str) and merge_commit_title in ["PR_TITLE", "MERGE_MESSAGE"] + ), merge_commit_title + assert merge_commit_message is github.GithubObject.NotSet or ( + isinstance(merge_commit_message, str) and merge_commit_message in ["PR_TITLE", "PR_BODY", "BLANK"] + ), merge_commit_message assert archived is github.GithubObject.NotSet or isinstance(archived, bool), archived + assert allow_forking is github.GithubObject.NotSet or isinstance(allow_forking, bool), allow_forking + assert web_commit_signoff_required is github.GithubObject.NotSet or isinstance( + web_commit_signoff_required, bool + ), web_commit_signoff_required + post_parameters = { "name": name, } + if description is not github.GithubObject.NotSet: post_parameters["description"] = description if homepage is not github.GithubObject.NotSet: post_parameters["homepage"] = homepage if private is not github.GithubObject.NotSet: post_parameters["private"] = private + if visibility is not github.GithubObject.NotSet: + post_parameters["visibility"] = visibility if has_issues is not github.GithubObject.NotSet: post_parameters["has_issues"] = has_issues if has_projects is not github.GithubObject.NotSet: post_parameters["has_projects"] = has_projects if has_wiki is not github.GithubObject.NotSet: post_parameters["has_wiki"] = has_wiki - if has_downloads is not github.GithubObject.NotSet: - post_parameters["has_downloads"] = has_downloads + if is_template is not github.GithubObject.NotSet: + post_parameters["is_template"] = is_template if default_branch is not github.GithubObject.NotSet: post_parameters["default_branch"] = default_branch if allow_squash_merge is not github.GithubObject.NotSet: post_parameters["allow_squash_merge"] = allow_squash_merge - if allow_auto_merge is not github.GithubObject.NotSet: - post_parameters["allow_auto_merge"] = allow_auto_merge - if allow_forking is not github.GithubObject.NotSet: - post_parameters["allow_forking"] = allow_forking if allow_merge_commit is not github.GithubObject.NotSet: post_parameters["allow_merge_commit"] = allow_merge_commit if allow_rebase_merge is not github.GithubObject.NotSet: post_parameters["allow_rebase_merge"] = allow_rebase_merge + if allow_auto_merge is not github.GithubObject.NotSet: + post_parameters["allow_auto_merge"] = allow_auto_merge if delete_branch_on_merge is not github.GithubObject.NotSet: post_parameters["delete_branch_on_merge"] = delete_branch_on_merge if allow_update_branch is not github.GithubObject.NotSet: post_parameters["allow_update_branch"] = allow_update_branch + if use_squash_pr_title_as_default is not github.GithubObject.NotSet: + post_parameters["use_squash_pr_title_as_default"] = use_squash_pr_title_as_default + if squash_merge_commit_title is not github.GithubObject.NotSet: + post_parameters["squash_merge_commit_title"] = squash_merge_commit_title + if squash_merge_commit_message is not github.GithubObject.NotSet: + post_parameters["squash_merge_commit_message"] = squash_merge_commit_message + if merge_commit_title is not github.GithubObject.NotSet: + post_parameters["merge_commit_title"] = merge_commit_title + if merge_commit_message is not github.GithubObject.NotSet: + post_parameters["merge_commit_message"] = merge_commit_message if archived is not github.GithubObject.NotSet: post_parameters["archived"] = archived + if allow_forking is not github.GithubObject.NotSet: + post_parameters["allow_forking"] = allow_forking + if web_commit_signoff_required is not github.GithubObject.NotSet: + post_parameters["web_commit_signoff_required"] = web_commit_signoff_required headers, data = self._requester.requestJsonAndCheck("PATCH", self.url, input=post_parameters) self._useAttributes(data) @@ -3915,6 +4017,8 @@ class Repository(github.GithubObject.CompletableGithubObject): self._language = github.GithubObject.NotSet self._languages_url = github.GithubObject.NotSet self._master_branch = github.GithubObject.NotSet + self._merge_commit_message = github.GithubObject.NotSet + self._merge_commit_title = github.GithubObject.NotSet self._merges_url = github.GithubObject.NotSet self._milestones_url = github.GithubObject.NotSet self._mirror_url = github.GithubObject.NotSet @@ -3933,6 +4037,8 @@ class Repository(github.GithubObject.CompletableGithubObject): self._releases_url = github.GithubObject.NotSet self._size = github.GithubObject.NotSet self._source = github.GithubObject.NotSet + self._squash_merge_commit_message = github.GithubObject.NotSet + self._squash_merge_commit_title = github.GithubObject.NotSet self._ssh_url = github.GithubObject.NotSet self._stargazers_count = github.GithubObject.NotSet self._stargazers_url = github.GithubObject.NotSet @@ -3947,9 +4053,11 @@ class Repository(github.GithubObject.CompletableGithubObject): self._trees_url = github.GithubObject.NotSet self._updated_at = github.GithubObject.NotSet self._url = github.GithubObject.NotSet + self._use_squash_pr_title_as_default = github.GithubObject.NotSet self._visibility = github.GithubObject.NotSet self._watchers = github.GithubObject.NotSet self._watchers_count = github.GithubObject.NotSet + self._web_commit_signoff_required = github.GithubObject.NotSet def _useAttributes(self, attributes: Dict[str, Any]) -> None: if "allow_auto_merge" in attributes: # pragma no branch @@ -4058,6 +4166,10 @@ class Repository(github.GithubObject.CompletableGithubObject): self._master_branch = self._makeStringAttribute(attributes["master_branch"]) if "merges_url" in attributes: # pragma no branch self._merges_url = self._makeStringAttribute(attributes["merges_url"]) + if "merge_commit_message" in attributes: # pragma no branch + self._merge_commit_message = self._makeStringAttribute(attributes["merge_commit_message"]) + if "merge_commit_title" in attributes: # pragma no branch + self._merge_commit_title = self._makeStringAttribute(attributes["merge_commit_title"]) if "milestones_url" in attributes: # pragma no branch self._milestones_url = self._makeStringAttribute(attributes["milestones_url"]) if "mirror_url" in attributes: # pragma no branch @@ -4092,6 +4204,10 @@ class Repository(github.GithubObject.CompletableGithubObject): self._size = self._makeIntAttribute(attributes["size"]) if "source" in attributes: # pragma no branch self._source = self._makeClassAttribute(Repository, attributes["source"]) + if "squash_merge_commit_message" in attributes: # pragma no branch + self._squash_merge_commit_message = self._makeStringAttribute(attributes["squash_merge_commit_message"]) + if "squash_merge_commit_title" in attributes: # pragma no branch + self._squash_merge_commit_title = self._makeStringAttribute(attributes["squash_merge_commit_title"]) if "ssh_url" in attributes: # pragma no branch self._ssh_url = self._makeStringAttribute(attributes["ssh_url"]) if "stargazers_count" in attributes: # pragma no branch @@ -4120,9 +4236,13 @@ class Repository(github.GithubObject.CompletableGithubObject): self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"]) if "url" in attributes: # pragma no branch self._url = self._makeStringAttribute(attributes["url"]) + if "use_squash_pr_title_as_default" in attributes: # pragma no branch + self._use_squash_pr_title_as_default = self._makeBoolAttribute(attributes["use_squash_pr_title_as_default"]) if "visibility" in attributes: # pragma no branch self._visibility = self._makeStringAttribute(attributes["visibility"]) if "watchers" in attributes: # pragma no branch self._watchers = self._makeIntAttribute(attributes["watchers"]) if "watchers_count" in attributes: # pragma no branch self._watchers_count = self._makeIntAttribute(attributes["watchers_count"]) + if "web_commit_signoff_required" in attributes: # pragma no branch + self._web_commit_signoff_required = self._makeBoolAttribute(attributes["web_commit_signoff_required"]) diff --git a/github/Repository.pyi b/github/Repository.pyi index c940b07a..47e92fba 100644 --- a/github/Repository.pyi +++ b/github/Repository.pyi @@ -335,18 +335,26 @@ class Repository(CompletableGithubObject): description: Union[str, _NotSetType] = ..., homepage: Union[str, _NotSetType] = ..., private: Union[bool, _NotSetType] = ..., + visibility: Union[str, _NotSetType] = ..., has_issues: Union[bool, _NotSetType] = ..., has_projects: Union[bool, _NotSetType] = ..., has_wiki: Union[bool, _NotSetType] = ..., - has_downloads: Union[bool, _NotSetType] = ..., + is_template: Union[bool, _NotSetType] = ..., default_branch: Union[str, _NotSetType] = ..., - allow_forking: Union[bool, _NotSetType] = ..., allow_squash_merge: Union[bool, _NotSetType] = ..., allow_merge_commit: Union[bool, _NotSetType] = ..., allow_rebase_merge: Union[bool, _NotSetType] = ..., + allow_auto_merge: Union[bool, _NotSetType] = ..., delete_branch_on_merge: Union[bool, _NotSetType] = ..., allow_update_branch: Union[bool, _NotSetType] = ..., + use_squash_pr_title_as_default: Union[bool, _NotSetType] = ..., + squash_merge_commit_title: Union[str, _NotSetType] = ..., + squash_merge_commit_message: Union[str, _NotSetType] = ..., + merge_commit_title: Union[str, _NotSetType] = ..., + merge_commit_message: Union[str, _NotSetType] = ..., archived: Union[bool, _NotSetType] = ..., + allow_forking: Union[bool, _NotSetType] = ..., + web_commit_signoff_required: Union[bool, _NotSetType] = ..., ) -> None: ... def enable_automated_security_fixes(self) -> bool: ... def enable_vulnerability_alert(self) -> bool: ... @@ -576,6 +584,10 @@ class Repository(CompletableGithubObject): def master_branch(self) -> Optional[str]: ... def merge(self, base: str, head: str, commit_message: Union[str, _NotSetType] = ...) -> Optional[Commit]: ... @property + def merge_commit_message(self) -> str: ... + @property + def merge_commit_title(self) -> str: ... + @property def merges_url(self) -> str: ... @property def milestones_url(self) -> str: ... @@ -617,6 +629,10 @@ class Repository(CompletableGithubObject): @property def source(self) -> Optional[Repository]: ... @property + def squash_merge_commit_message(self) -> str: ... + @property + def squash_merge_commit_title(self) -> str: ... + @property def ssh_url(self) -> str: ... @property def stargazers_count(self) -> int: ... @@ -664,8 +680,12 @@ class Repository(CompletableGithubObject): @property def url(self) -> str: ... @property + def use_squash_pr_title_as_default(self) -> bool: ... + @property def visibility(self) -> str: ... @property def watchers(self) -> int: ... @property def watchers_count(self) -> int: ... + @property + def web_commit_signoff_required(self) -> bool: ... diff --git a/tests/ReplayData/Repository.setUp.txt b/tests/ReplayData/Repository.setUp.txt index 8e4c7118..5b1f3399 100644 --- a/tests/ReplayData/Repository.setUp.txt +++ b/tests/ReplayData/Repository.setUp.txt @@ -7,7 +7,7 @@ None None 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4912'), ('content-length', '801'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"8d4bf64381cca7c6ba5753129f5fc552"'), ('date', 'Sun, 27 May 2012 07:17:08 GMT'), ('content-type', 'application/json; charset=utf-8')] -{"type":"User","disk_usage":16976,"public_gists":3,"bio":"","blog":"http://vincent-jacques.net","url":"https://api.github.com/users/jacquev6","private_gists":5,"collaborators":0,"plan":{"private_repos":5,"collaborators":1,"name":"micro","space":614400},"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","company":"Criteo","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","email":"vincent@vincent-jacques.net","total_private_repos":5,"followers":13,"name":"Vincent Jacques","public_repos":11,"created_at":"2010-07-09T06:10:06Z","location":"Paris, France","id":327146,"owned_private_repos":5,"following":24,"html_url":"https://github.com/jacquev6","hireable":false} +{"type":"User","disk_usage":16976,"public_gists":3,"bio":"","blog":"http://vincent-jacques.net","url":"https://api.github.com/users/jacquev6","private_gists":5,"collaborators":0,"plan":{"private_repos":5,"collaborators":1,"name":"micro","space":614400},"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","company":"Criteo","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","email":"vincent@vincent-jacques.net","total_private_repos":5,"followers":13,"name":"Vincent Jacques","public_repos":11,"created_at":"2010-07-09T06:10:06Z","location":"Paris, France","id":327146,"owned_private_repos":5,"following":24,"html_url":"https://github.com/jacquev6","hireable":false, "use_squash_pr_title_as_default": true, "squash_merge_commit_title": "PR_TITLE", "squash_merge_commit_message": "COMMIT_MESSAGES", "merge_commit_title": "PR_TITLE", "merge_commit_message": "PR_BODY", "web_commit_signoff_required": true} https GET @@ -18,4 +18,4 @@ None None 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4911'), ('content-length', '1129'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"1a93ec821b0bd7094340a9fc34017aa0"'), ('date', 'Sun, 27 May 2012 07:17:09 GMT'), ('content-type', 'application/json; charset=utf-8')] -{"clone_url":"https://github.com/jacquev6/PyGithub.git","has_downloads":true,"watchers":15,"git_url":"git://github.com/jacquev6/PyGithub.git","deployments_url":"https://api.github.com/repos/jacquev6/PyGithub/deployments","releases_url":"https://api.github.com/repos/jacquev6/PyGithub/releases{/id}","updated_at":"2012-05-27T06:55:28Z","permissions":{"pull":true,"admin":true,"push":true},"homepage":"http://vincent-jacques.net/PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub","mirror_url":null,"has_pages":false,"has_wiki":false,"has_issues":true,"fork":false,"forks":3,"size":308,"private":false,"open_issues":16,"svn_url":"https://github.com/jacquev6/PyGithub","owner":{"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","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"name":"PyGithub","language":"Python","description":"Python library implementing the full Github API v3","ssh_url":"git@github.com:jacquev6/PyGithub.git","pushed_at":"2012-05-27T06:00:28Z","created_at":"2012-02-25T12:53:47Z","id":3544490,"html_url":"https://github.com/jacquev6/PyGithub","full_name":"jacquev6/PyGithub"} +{"clone_url":"https://github.com/jacquev6/PyGithub.git","has_downloads":true,"watchers":15,"git_url":"git://github.com/jacquev6/PyGithub.git","deployments_url":"https://api.github.com/repos/jacquev6/PyGithub/deployments","releases_url":"https://api.github.com/repos/jacquev6/PyGithub/releases{/id}","updated_at":"2012-05-27T06:55:28Z","permissions":{"pull":true,"admin":true,"push":true},"homepage":"http://vincent-jacques.net/PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub","mirror_url":null,"has_pages":false,"has_wiki":false,"has_issues":true,"fork":false,"forks":3,"size":308,"private":false,"open_issues":16,"svn_url":"https://github.com/jacquev6/PyGithub","owner":{"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","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"name":"PyGithub","language":"Python","description":"Python library implementing the full Github API v3","ssh_url":"git@github.com:jacquev6/PyGithub.git","pushed_at":"2012-05-27T06:00:28Z","created_at":"2012-02-25T12:53:47Z","id":3544490,"html_url":"https://github.com/jacquev6/PyGithub","full_name":"jacquev6/PyGithub", "use_squash_pr_title_as_default": true, "squash_merge_commit_title": "PR_TITLE", "squash_merge_commit_message": "COMMIT_MESSAGES", "merge_commit_title": "PR_TITLE", "merge_commit_message": "PR_BODY", "web_commit_signoff_required": true} diff --git a/tests/ReplayData/Repository.testEditWithAllArguments.txt b/tests/ReplayData/Repository.testEditWithAllArguments.txt index fdf5bf2e..acced5e4 100644 --- a/tests/ReplayData/Repository.testEditWithAllArguments.txt +++ b/tests/ReplayData/Repository.testEditWithAllArguments.txt @@ -4,10 +4,10 @@ api.github.com None /repos/jacquev6/PyGithub {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} -{"has_wiki": false, "name": "PyGithub", "has_downloads": true, "has_issues": true, "homepage": "http://vincent-jacques.net/PyGithub", "private": true, "description": "Description edited by PyGithub", "has_projects": false, "allow_auto_merge": true, "allow_update_branch": true, "allow_forking": true, "allow_squash_merge": true, "allow_merge_commit": true, "allow_rebase_merge": true, "delete_branch_on_merge": true} +{"has_wiki": false, "name": "PyGithub", "has_issues": true, "homepage": "http://vincent-jacques.net/PyGithub", "private": true, "description": "Description edited by PyGithub", "has_projects": false, "allow_auto_merge": true, "allow_update_branch": true, "allow_forking": true, "allow_squash_merge": true, "allow_merge_commit": true, "allow_rebase_merge": true, "delete_branch_on_merge": true, "is_template": true, "use_squash_pr_title_as_default": true, "squash_merge_commit_title": "PR_TITLE", "squash_merge_commit_message": "COMMIT_MESSAGES", "merge_commit_title": "PR_TITLE", "merge_commit_message": "PR_BODY", "web_commit_signoff_required": true} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4953'), ('content-length', '1109'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"749313ec2d171323deb61f9f4c85e84f"'), ('date', 'Sat, 26 May 2012 11:22:13 GMT'), ('content-type', 'application/json; charset=utf-8')] -{"clone_url":"https://github.com/jacquev6/PyGithub.git","has_downloads":true,"watchers":13,"updated_at":"2012-05-26T11:22:13Z","permissions":{"pull":true,"admin":true,"push":true},"homepage":"http://vincent-jacques.net/PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub","has_wiki":false,"has_issues":true,"fork":false,"forks":2,"size":412,"git_url":"git://github.com/jacquev6/PyGithub.git","private":false,"open_issues":16,"mirror_url":null,"svn_url":"https://github.com/jacquev6/PyGithub","owner":{"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","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"name":"PyGithub","language":"Python","description":"Description edited by PyGithub","ssh_url":"git@github.com:jacquev6/PyGithub.git","pushed_at":"2012-05-26T10:01:38Z","created_at":"2012-02-25T12:53:47Z","id":3544490,"html_url":"https://github.com/jacquev6/PyGithub","full_name":"jacquev6/PyGithub", "has_projects": false, "allow_auto_merge": true, "allow_update_branch": true, "allow_forking": true, "allow_squash_merge": true, "allow_merge_commit": true, "allow_rebase_merge": true, "delete_branch_on_merge": true} +{"clone_url":"https://github.com/jacquev6/PyGithub.git","watchers":13,"updated_at":"2012-05-26T11:22:13Z","permissions":{"pull":true,"admin":true,"push":true},"homepage":"http://vincent-jacques.net/PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub","has_wiki":false,"has_issues":true,"fork":false,"forks":2,"size":412,"git_url":"git://github.com/jacquev6/PyGithub.git","private":false,"open_issues":16,"mirror_url":null,"svn_url":"https://github.com/jacquev6/PyGithub","owner":{"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","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"name":"PyGithub","language":"Python","description":"Description edited by PyGithub","ssh_url":"git@github.com:jacquev6/PyGithub.git","pushed_at":"2012-05-26T10:01:38Z","created_at":"2012-02-25T12:53:47Z","id":3544490,"html_url":"https://github.com/jacquev6/PyGithub","full_name":"jacquev6/PyGithub", "has_projects": false, "allow_auto_merge": true, "allow_update_branch": true, "allow_forking": true, "allow_squash_merge": true, "allow_merge_commit": true, "allow_rebase_merge": true, "delete_branch_on_merge": true, "is_template": true, "use_squash_pr_title_as_default": true, "squash_merge_commit_title": "PR_TITLE", "squash_merge_commit_message": "COMMIT_MESSAGES", "merge_commit_title": "PR_TITLE", "merge_commit_message": "PR_BODY", "web_commit_signoff_required": true} https PATCH @@ -18,4 +18,4 @@ None {"name": "PyGithub", "description": "Python library implementing the full Github API v3"} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4952'), ('content-length', '1129'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"c1328d95af7d85267acb5754968b2c0b"'), ('date', 'Sat, 26 May 2012 11:22:13 GMT'), ('content-type', 'application/json; charset=utf-8')] -{"clone_url":"https://github.com/jacquev6/PyGithub.git","has_downloads":true,"watchers":13,"updated_at":"2012-05-26T11:22:13Z","permissions":{"pull":true,"admin":true,"push":true},"homepage":"http://vincent-jacques.net/PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub","mirror_url":null,"has_wiki":false,"has_issues":true,"fork":false,"forks":2,"size":412,"private":false,"open_issues":16,"svn_url":"https://github.com/jacquev6/PyGithub","owner":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146,"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"name":"PyGithub","language":"Python","description":"Python library implementing the full Github API v3","ssh_url":"git@github.com:jacquev6/PyGithub.git","pushed_at":"2012-05-26T10:01:38Z","created_at":"2012-02-25T12:53:47Z","id":3544490,"git_url":"git://github.com/jacquev6/PyGithub.git","html_url":"https://github.com/jacquev6/PyGithub","full_name":"jacquev6/PyGithub"} +{"clone_url":"https://github.com/jacquev6/PyGithub.git","watchers":13,"updated_at":"2012-05-26T11:22:13Z","permissions":{"pull":true,"admin":true,"push":true},"homepage":"http://vincent-jacques.net/PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub","mirror_url":null,"has_wiki":false,"has_issues":true,"fork":false,"forks":2,"size":412,"private":false,"open_issues":16,"svn_url":"https://github.com/jacquev6/PyGithub","owner":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146,"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"name":"PyGithub","language":"Python","description":"Python library implementing the full Github API v3","ssh_url":"git@github.com:jacquev6/PyGithub.git","pushed_at":"2012-05-26T10:01:38Z","created_at":"2012-02-25T12:53:47Z","id":3544490,"git_url":"git://github.com/jacquev6/PyGithub.git","html_url":"https://github.com/jacquev6/PyGithub","full_name":"jacquev6/PyGithub"} diff --git a/tests/Repository.py b/tests/Repository.py index ecff5c64..759f6862 100644 --- a/tests/Repository.py +++ b/tests/Repository.py @@ -122,6 +122,13 @@ class Repository(Framework.TestCase): self.assertIn(self.repo.permissions.maintain, [None, False, True]) self.assertIn(self.repo.permissions.triage, [None, False, True]) + self.assertTrue(self.repo.use_squash_pr_title_as_default) + self.assertEqual(self.repo.squash_merge_commit_title, "PR_TITLE") + self.assertEqual(self.repo.squash_merge_commit_message, "COMMIT_MESSAGES") + self.assertEqual(self.repo.merge_commit_title, "PR_TITLE") + self.assertEqual(self.repo.merge_commit_message, "PR_BODY") + self.assertTrue(self.repo.web_commit_signoff_required) + def testEditWithoutArguments(self): self.repo.edit("PyGithub") @@ -134,7 +141,6 @@ class Repository(Framework.TestCase): has_issues=True, has_projects=False, has_wiki=False, - has_downloads=True, allow_auto_merge=True, allow_forking=True, allow_update_branch=True, @@ -142,6 +148,13 @@ class Repository(Framework.TestCase): allow_merge_commit=True, allow_rebase_merge=True, delete_branch_on_merge=True, + use_squash_pr_title_as_default=True, + is_template=True, + squash_merge_commit_title="PR_TITLE", + squash_merge_commit_message="COMMIT_MESSAGES", + merge_commit_title="PR_TITLE", + merge_commit_message="PR_BODY", + web_commit_signoff_required=True, ) self.assertEqual(self.repo.description, "Description edited by PyGithub") self.repo.edit("PyGithub", "Python library implementing the full Github API v3") @@ -151,13 +164,18 @@ class Repository(Framework.TestCase): self.assertTrue(self.repo.has_issues) self.assertFalse(self.repo.has_projects) self.assertFalse(self.repo.has_wiki) - self.assertTrue(self.repo.has_downloads) self.assertTrue(self.repo.allow_auto_merge) self.assertTrue(self.repo.allow_forking) self.assertTrue(self.repo.allow_squash_merge) self.assertTrue(self.repo.allow_merge_commit) self.assertTrue(self.repo.allow_rebase_merge) self.assertTrue(self.repo.delete_branch_on_merge) + self.assertTrue(self.repo.use_squash_pr_title_as_default) + self.assertEqual(self.repo.squash_merge_commit_title, "PR_TITLE") + self.assertEqual(self.repo.squash_merge_commit_message, "COMMIT_MESSAGES") + self.assertEqual(self.repo.merge_commit_title, "PR_TITLE") + self.assertEqual(self.repo.merge_commit_message, "PR_BODY") + self.assertTrue(self.repo.web_commit_signoff_required) def testEditWithDefaultBranch(self): self.assertEqual(self.repo.master_branch, None)