Skip to content

Commit f90bcd6

Browse files
NargiTsigmavirus24
authored andcommitted
add has_projects to create_repository method (sigmavirus24#955)
* add has_projects to create_repository method * pytest 5.x.x not compatible with <py35 * fix tests * improve broken tests * fix unit test * Fix broken tests
1 parent 4443eeb commit f90bcd6

15 files changed

+23
-11
lines changed

src/github3/github.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,7 @@ def create_repository(
681681
has_wiki=True,
682682
auto_init=False,
683683
gitignore_template="",
684+
has_projects=True
684685
):
685686
"""Create a repository for the authenticated user.
686687
@@ -706,6 +707,9 @@ def create_repository(
706707
:param str gitignore_template:
707708
(optional), name of the git template to use; ignored if auto_init =
708709
False.
710+
:param bool has_projects:
711+
(optional), If ``True``, enable projects for this repository. API
712+
default: ``True``
709713
:returns:
710714
created repository
711715
:rtype:
@@ -721,6 +725,7 @@ def create_repository(
721725
"has_wiki": has_wiki,
722726
"auto_init": auto_init,
723727
"gitignore_template": gitignore_template,
728+
"has_projects": has_projects
724729
}
725730
json = self._json(self._post(url, data=data), 201)
726731
return self._instance_or_null(repo.Repository, json)

src/github3/orgs.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,7 @@ def create_repository(
640640
auto_init=False,
641641
gitignore_template="",
642642
license_template="",
643+
has_projects=True
643644
):
644645
"""Create a repository for this organization.
645646
@@ -676,6 +677,9 @@ def create_repository(
676677
:param str license_template:
677678
(optional), name of the license; this is ignored if auto_int is
678679
False.
680+
:param bool has_projects:
681+
(optional), If ``True``, enable projects for this repository. API
682+
default: ``True``
679683
:returns:
680684
the created repository
681685
:rtype:
@@ -692,6 +696,7 @@ def create_repository(
692696
"license_template": license_template,
693697
"auto_init": auto_init,
694698
"gitignore_template": gitignore_template,
699+
"has_projects": has_projects
695700
}
696701
if int(team_id) > 0:
697702
data.update({"team_id": team_id})
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"http_interactions": [{"request": {"body": {"encoding": "utf-8", "string": "{\"name\": \"my-new-repo\", \"description\": \"Test repo creation\", \"homepage\": \"\", \"private\": false, \"has_issues\": true, \"has_wiki\": true, \"auto_init\": false, \"gitignore_template\": \"\"}"}, "headers": {"User-Agent": "github3.py/1.0.0a4", "Accept-Encoding": "gzip, deflate", "Accept": "application/vnd.github.v3.full+json", "Connection": "keep-alive", "Accept-Charset": "utf-8", "Content-Type": "application/json", "Content-Length": "178", "Authorization": "Basic <BASIC_AUTH>"}, "method": "POST", "uri": "https://api.github.com/user/repos"}, "response": {"body": {"encoding": "utf-8", "string": "{\"id\":115671102,\"name\":\"my-new-repo\",\"full_name\":\"gh3test/my-new-repo\",\"owner\":{\"login\":\"gh3test\",\"id\":2354350,\"avatar_url\":\"https://avatars2.githubusercontent.com/u/2354350?v=4\",\"gravatar_id\":\"\",\"url\":\"https://api.github.com/users/gh3test\",\"html_url\":\"https://github.com/gh3test\",\"followers_url\":\"https://api.github.com/users/gh3test/followers\",\"following_url\":\"https://api.github.com/users/gh3test/following{/other_user}\",\"gists_url\":\"https://api.github.com/users/gh3test/gists{/gist_id}\",\"starred_url\":\"https://api.github.com/users/gh3test/starred{/owner}{/repo}\",\"subscriptions_url\":\"https://api.github.com/users/gh3test/subscriptions\",\"organizations_url\":\"https://api.github.com/users/gh3test/orgs\",\"repos_url\":\"https://api.github.com/users/gh3test/repos\",\"events_url\":\"https://api.github.com/users/gh3test/events{/privacy}\",\"received_events_url\":\"https://api.github.com/users/gh3test/received_events\",\"type\":\"User\",\"site_admin\":false},\"private\":false,\"html_url\":\"https://github.com/gh3test/my-new-repo\",\"description\":\"Test repo creation\",\"fork\":false,\"url\":\"https://api.github.com/repos/gh3test/my-new-repo\",\"forks_url\":\"https://api.github.com/repos/gh3test/my-new-repo/forks\",\"keys_url\":\"https://api.github.com/repos/gh3test/my-new-repo/keys{/key_id}\",\"collaborators_url\":\"https://api.github.com/repos/gh3test/my-new-repo/collaborators{/collaborator}\",\"teams_url\":\"https://api.github.com/repos/gh3test/my-new-repo/teams\",\"hooks_url\":\"https://api.github.com/repos/gh3test/my-new-repo/hooks\",\"issue_events_url\":\"https://api.github.com/repos/gh3test/my-new-repo/issues/events{/number}\",\"events_url\":\"https://api.github.com/repos/gh3test/my-new-repo/events\",\"assignees_url\":\"https://api.github.com/repos/gh3test/my-new-repo/assignees{/user}\",\"branches_url\":\"https://api.github.com/repos/gh3test/my-new-repo/branches{/branch}\",\"tags_url\":\"https://api.github.com/repos/gh3test/my-new-repo/tags\",\"blobs_url\":\"https://api.github.com/repos/gh3test/my-new-repo/git/blobs{/sha}\",\"git_tags_url\":\"https://api.github.com/repos/gh3test/my-new-repo/git/tags{/sha}\",\"git_refs_url\":\"https://api.github.com/repos/gh3test/my-new-repo/git/refs{/sha}\",\"trees_url\":\"https://api.github.com/repos/gh3test/my-new-repo/git/trees{/sha}\",\"statuses_url\":\"https://api.github.com/repos/gh3test/my-new-repo/statuses/{sha}\",\"languages_url\":\"https://api.github.com/repos/gh3test/my-new-repo/languages\",\"stargazers_url\":\"https://api.github.com/repos/gh3test/my-new-repo/stargazers\",\"contributors_url\":\"https://api.github.com/repos/gh3test/my-new-repo/contributors\",\"subscribers_url\":\"https://api.github.com/repos/gh3test/my-new-repo/subscribers\",\"subscription_url\":\"https://api.github.com/repos/gh3test/my-new-repo/subscription\",\"commits_url\":\"https://api.github.com/repos/gh3test/my-new-repo/commits{/sha}\",\"git_commits_url\":\"https://api.github.com/repos/gh3test/my-new-repo/git/commits{/sha}\",\"comments_url\":\"https://api.github.com/repos/gh3test/my-new-repo/comments{/number}\",\"issue_comment_url\":\"https://api.github.com/repos/gh3test/my-new-repo/issues/comments{/number}\",\"contents_url\":\"https://api.github.com/repos/gh3test/my-new-repo/contents/{+path}\",\"compare_url\":\"https://api.github.com/repos/gh3test/my-new-repo/compare/{base}...{head}\",\"merges_url\":\"https://api.github.com/repos/gh3test/my-new-repo/merges\",\"archive_url\":\"https://api.github.com/repos/gh3test/my-new-repo/{archive_format}{/ref}\",\"downloads_url\":\"https://api.github.com/repos/gh3test/my-new-repo/downloads\",\"issues_url\":\"https://api.github.com/repos/gh3test/my-new-repo/issues{/number}\",\"pulls_url\":\"https://api.github.com/repos/gh3test/my-new-repo/pulls{/number}\",\"milestones_url\":\"https://api.github.com/repos/gh3test/my-new-repo/milestones{/number}\",\"notifications_url\":\"https://api.github.com/repos/gh3test/my-new-repo/notifications{?since,all,participating}\",\"labels_url\":\"https://api.github.com/repos/gh3test/my-new-repo/labels{/name}\",\"releases_url\":\"https://api.github.com/repos/gh3test/my-new-repo/releases{/id}\",\"deployments_url\":\"https://api.github.com/repos/gh3test/my-new-repo/deployments\",\"created_at\":\"2017-12-29T00:45:04Z\",\"updated_at\":\"2017-12-29T00:45:04Z\",\"pushed_at\":\"2017-12-29T00:45:05Z\",\"git_url\":\"git://github.com/gh3test/my-new-repo.git\",\"ssh_url\":\"git@github.com:gh3test/my-new-repo.git\",\"clone_url\":\"https://github.com/gh3test/my-new-repo.git\",\"svn_url\":\"https://github.com/gh3test/my-new-repo\",\"homepage\":\"\",\"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,\"open_issues_count\":0,\"license\":null,\"forks\":0,\"open_issues\":0,\"watchers\":0,\"default_branch\":\"master\",\"permissions\":{\"admin\":true,\"push\":true,\"pull\":true},\"allow_squash_merge\":true,\"allow_merge_commit\":true,\"allow_rebase_merge\":true,\"network_count\":0,\"subscribers_count\":0}"}, "headers": {"Server": "GitHub.com", "Date": "Fri, 29 Dec 2017 00:45:05 GMT", "Content-Type": "application/json; charset=utf-8", "Content-Length": "4865", "Status": "201 Created", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4999", "X-RateLimit-Reset": "1514511905", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "ETag": "\"8b849529e9ef766eb1d2075cee6ea003\"", "Location": "https://api.github.com/repos/gh3test/my-new-repo", "X-GitHub-Media-Type": "github.v3; param=full; format=json", "Access-Control-Expose-Headers": "ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "Access-Control-Allow-Origin": "*", "Content-Security-Policy": "default-src 'none'", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", "X-Content-Type-Options": "nosniff", "X-Frame-Options": "deny", "X-XSS-Protection": "1; mode=block", "X-Runtime-rack": "0.705179", "X-GitHub-Request-Id": "C75E:8324:21EAFF5:4A04BD4:5A459010"}, "status": {"code": 201, "message": "Created"}, "url": "https://api.github.com/user/repos"}, "recorded_at": "2017-12-29T00:45:05"}], "recorded_with": "betamax/0.8.0"}
1+
{"http_interactions": [{"request": {"body": {"encoding": "utf-8", "string": "{\"name\": \"my-new-repo\", \"description\": \"Test repo creation\", \"homepage\": \"\", \"private\": false, \"has_issues\": true, \"has_wiki\": true, \"auto_init\": false, \"gitignore_template\": \"\", \"has_projects\":true}"}, "headers": {"User-Agent": "github3.py/1.0.0a4", "Accept-Encoding": "gzip, deflate", "Accept": "application/vnd.github.v3.full+json", "Connection": "keep-alive", "Accept-Charset": "utf-8", "Content-Type": "application/json", "Content-Length": "178", "Authorization": "Basic <BASIC_AUTH>"}, "method": "POST", "uri": "https://api.github.com/user/repos"}, "response": {"body": {"encoding": "utf-8", "string": "{\"id\":115671102,\"name\":\"my-new-repo\",\"full_name\":\"gh3test/my-new-repo\",\"owner\":{\"login\":\"gh3test\",\"id\":2354350,\"avatar_url\":\"https://avatars2.githubusercontent.com/u/2354350?v=4\",\"gravatar_id\":\"\",\"url\":\"https://api.github.com/users/gh3test\",\"html_url\":\"https://github.com/gh3test\",\"followers_url\":\"https://api.github.com/users/gh3test/followers\",\"following_url\":\"https://api.github.com/users/gh3test/following{/other_user}\",\"gists_url\":\"https://api.github.com/users/gh3test/gists{/gist_id}\",\"starred_url\":\"https://api.github.com/users/gh3test/starred{/owner}{/repo}\",\"subscriptions_url\":\"https://api.github.com/users/gh3test/subscriptions\",\"organizations_url\":\"https://api.github.com/users/gh3test/orgs\",\"repos_url\":\"https://api.github.com/users/gh3test/repos\",\"events_url\":\"https://api.github.com/users/gh3test/events{/privacy}\",\"received_events_url\":\"https://api.github.com/users/gh3test/received_events\",\"type\":\"User\",\"site_admin\":false},\"private\":false,\"html_url\":\"https://github.com/gh3test/my-new-repo\",\"description\":\"Test repo creation\",\"fork\":false,\"url\":\"https://api.github.com/repos/gh3test/my-new-repo\",\"forks_url\":\"https://api.github.com/repos/gh3test/my-new-repo/forks\",\"keys_url\":\"https://api.github.com/repos/gh3test/my-new-repo/keys{/key_id}\",\"collaborators_url\":\"https://api.github.com/repos/gh3test/my-new-repo/collaborators{/collaborator}\",\"teams_url\":\"https://api.github.com/repos/gh3test/my-new-repo/teams\",\"hooks_url\":\"https://api.github.com/repos/gh3test/my-new-repo/hooks\",\"issue_events_url\":\"https://api.github.com/repos/gh3test/my-new-repo/issues/events{/number}\",\"events_url\":\"https://api.github.com/repos/gh3test/my-new-repo/events\",\"assignees_url\":\"https://api.github.com/repos/gh3test/my-new-repo/assignees{/user}\",\"branches_url\":\"https://api.github.com/repos/gh3test/my-new-repo/branches{/branch}\",\"tags_url\":\"https://api.github.com/repos/gh3test/my-new-repo/tags\",\"blobs_url\":\"https://api.github.com/repos/gh3test/my-new-repo/git/blobs{/sha}\",\"git_tags_url\":\"https://api.github.com/repos/gh3test/my-new-repo/git/tags{/sha}\",\"git_refs_url\":\"https://api.github.com/repos/gh3test/my-new-repo/git/refs{/sha}\",\"trees_url\":\"https://api.github.com/repos/gh3test/my-new-repo/git/trees{/sha}\",\"statuses_url\":\"https://api.github.com/repos/gh3test/my-new-repo/statuses/{sha}\",\"languages_url\":\"https://api.github.com/repos/gh3test/my-new-repo/languages\",\"stargazers_url\":\"https://api.github.com/repos/gh3test/my-new-repo/stargazers\",\"contributors_url\":\"https://api.github.com/repos/gh3test/my-new-repo/contributors\",\"subscribers_url\":\"https://api.github.com/repos/gh3test/my-new-repo/subscribers\",\"subscription_url\":\"https://api.github.com/repos/gh3test/my-new-repo/subscription\",\"commits_url\":\"https://api.github.com/repos/gh3test/my-new-repo/commits{/sha}\",\"git_commits_url\":\"https://api.github.com/repos/gh3test/my-new-repo/git/commits{/sha}\",\"comments_url\":\"https://api.github.com/repos/gh3test/my-new-repo/comments{/number}\",\"issue_comment_url\":\"https://api.github.com/repos/gh3test/my-new-repo/issues/comments{/number}\",\"contents_url\":\"https://api.github.com/repos/gh3test/my-new-repo/contents/{+path}\",\"compare_url\":\"https://api.github.com/repos/gh3test/my-new-repo/compare/{base}...{head}\",\"merges_url\":\"https://api.github.com/repos/gh3test/my-new-repo/merges\",\"archive_url\":\"https://api.github.com/repos/gh3test/my-new-repo/{archive_format}{/ref}\",\"downloads_url\":\"https://api.github.com/repos/gh3test/my-new-repo/downloads\",\"issues_url\":\"https://api.github.com/repos/gh3test/my-new-repo/issues{/number}\",\"pulls_url\":\"https://api.github.com/repos/gh3test/my-new-repo/pulls{/number}\",\"milestones_url\":\"https://api.github.com/repos/gh3test/my-new-repo/milestones{/number}\",\"notifications_url\":\"https://api.github.com/repos/gh3test/my-new-repo/notifications{?since,all,participating}\",\"labels_url\":\"https://api.github.com/repos/gh3test/my-new-repo/labels{/name}\",\"releases_url\":\"https://api.github.com/repos/gh3test/my-new-repo/releases{/id}\",\"deployments_url\":\"https://api.github.com/repos/gh3test/my-new-repo/deployments\",\"created_at\":\"2017-12-29T00:45:04Z\",\"updated_at\":\"2017-12-29T00:45:04Z\",\"pushed_at\":\"2017-12-29T00:45:05Z\",\"git_url\":\"git://github.com/gh3test/my-new-repo.git\",\"ssh_url\":\"git@github.com:gh3test/my-new-repo.git\",\"clone_url\":\"https://github.com/gh3test/my-new-repo.git\",\"svn_url\":\"https://github.com/gh3test/my-new-repo\",\"homepage\":\"\",\"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,\"open_issues_count\":0,\"license\":null,\"forks\":0,\"open_issues\":0,\"watchers\":0,\"default_branch\":\"master\",\"permissions\":{\"admin\":true,\"push\":true,\"pull\":true},\"allow_squash_merge\":true,\"allow_merge_commit\":true,\"allow_rebase_merge\":true,\"network_count\":0,\"subscribers_count\":0}"}, "headers": {"Server": "GitHub.com", "Date": "Fri, 29 Dec 2017 00:45:05 GMT", "Content-Type": "application/json; charset=utf-8", "Content-Length": "4865", "Status": "201 Created", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4999", "X-RateLimit-Reset": "1514511905", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "ETag": "\"8b849529e9ef766eb1d2075cee6ea003\"", "Location": "https://api.github.com/repos/gh3test/my-new-repo", "X-GitHub-Media-Type": "github.v3; param=full; format=json", "Access-Control-Expose-Headers": "ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "Access-Control-Allow-Origin": "*", "Content-Security-Policy": "default-src 'none'", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", "X-Content-Type-Options": "nosniff", "X-Frame-Options": "deny", "X-XSS-Protection": "1; mode=block", "X-Runtime-rack": "0.705179", "X-GitHub-Request-Id": "C75E:8324:21EAFF5:4A04BD4:5A459010"}, "status": {"code": 201, "message": "Created"}, "url": "https://api.github.com/user/repos"}, "recorded_at": "2017-12-29T00:45:05"}], "recorded_with": "betamax/0.8.0"}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy