Add create project method and tests

This commit is contained in:
Anuj Bansal
2020-03-15 22:12:44 +05:30
parent afb1259a4e
commit 801ea38551
4 changed files with 77 additions and 0 deletions
+20
View File
@@ -391,6 +391,26 @@ class Organization(github.GithubObject.CompletableGithubObject):
)
return github.Hook.Hook(self._requester, headers, data, completed=True)
def create_project(self, name, body=github.GithubObject.NotSet):
"""
:calls: `POST /orgs/:org/projects <https://developer.github.com/v3/projects/#create-an-organization-project>`_
:param name: string
:param body: string
:rtype: :class:`github.Project.Project`
"""
assert isinstance(name, str), name
assert body is github.GithubObject.NotSet or isinstance(body, str), body
post_parameters = {"name": name}
if body is not github.GithubObject.NotSet:
post_parameters["body"] = body
headers, data = self._requester.requestJsonAndCheck(
"POST",
self.url + "/projects",
input=post_parameters,
headers={"Accept": Consts.mediaTypeProjectsPreview},
)
return github.Project.Project(self._requester, headers, data, completed=True)
def create_repo(
self,
name,