Complete "ref in Repository.get_contents and .get_readme" (pull #124)

Add documentation and automated tests
This commit is contained in:
Vincent Jacques
2012-12-25 11:50:54 +01:00
parent aac5eec5fd
commit d8e4ece9a7
5 changed files with 28 additions and 7 deletions
+9 -5
View File
@@ -590,11 +590,11 @@ class Repository(github.GithubObject.GithubObject):
url_parameters
)
def get_contents(self, path, ref=GithubObject.NotSet):
def get_contents(self, path, ref=github.GithubObject.NotSet):
assert isinstance(path, (str, unicode)), path
assert ref is GithubObject.NotSet or isinstance(ref, (str, unicode)), ref
assert ref is github.GithubObject.NotSet or isinstance(ref, (str, unicode)), ref
url_parameters = dict()
if ref is not GithubObject.NotSet:
if ref is not github.GithubObject.NotSet:
url_parameters["ref"] = ref
headers, data = self._requester.requestAndCheck(
"GET",
@@ -899,11 +899,15 @@ class Repository(github.GithubObject.GithubObject):
url_parameters
)
def get_readme(self):
def get_readme(self, ref=github.GithubObject.NotSet):
assert ref is github.GithubObject.NotSet or isinstance(ref, (str, unicode)), ref
url_parameters = dict()
if ref is not github.GithubObject.NotSet:
url_parameters["ref"] = ref
headers, data = self._requester.requestAndCheck(
"GET",
self.url + "/readme",
None,
url_parameters,
None
)
return github.ContentFile.ContentFile(self._requester, data, completed=True)