mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
adds support for content dirs
This commit is contained in:
@@ -1235,6 +1235,11 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
self.url + "/contents" + path,
|
||||
parameters=url_parameters
|
||||
)
|
||||
if isinstance(data, list):
|
||||
return [
|
||||
github.ContentFile.ContentFile(self._requester, headers, item, completed=False)
|
||||
for item in data
|
||||
]
|
||||
return github.ContentFile.ContentFile(self._requester, headers, data, completed=True)
|
||||
|
||||
def create_file(self, path, message, content,
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -500,6 +500,12 @@ class Repository(Framework.TestCase):
|
||||
self.assertEqual(len(self.repo.get_readme().content), 10212)
|
||||
self.assertEqual(len(self.repo.get_contents("/doc/ReferenceOfClasses.md").content), 38121)
|
||||
|
||||
def testGetContentDir(self):
|
||||
|
||||
contents = self.repo.get_contents("/")
|
||||
self.assertTrue(isinstance(contents, list))
|
||||
self.assertEquals(len(contents), 14)
|
||||
|
||||
def testGetContentsWithRef(self):
|
||||
self.assertEqual(len(self.repo.get_readme(ref="refs/heads/topic/ExperimentOnDocumentation").content), 6747)
|
||||
self.assertEqual(len(self.repo.get_contents("/doc/ReferenceOfClasses.md", ref="refs/heads/topic/ExperimentOnDocumentation").content), 43929)
|
||||
|
||||
Reference in New Issue
Block a user