def test_(self): gitrepo = GitRepoHelper.history(self.token, self.reponame) self.assertEquals(gitrepo.commit_history[0][0]['content'], 'this is a test') self.assertEquals(gitrepo.commit_history[0][2]['content'], 'this is a test2') self.assertEquals(gitrepo.commit_history[1][0]['content'], '# testpygithub')
def test_(self): self.headref.edit(self.git_commit.sha) self.assertEquals(self.git_commit.sha, GitCommitHelper._get_ref_sha(self.repo)) gitrepo = GitRepoHelper.history(self.token, self.reponame) self.assertEquals(gitrepo.commit_history[0][0]['path'], environ["MYHOME"] + '\\testpygithub\\git_test.txt') self.assertEquals(gitrepo.commit_history[0][1]['path'], 'README.md') self.assertEquals(gitrepo.commit_history[1][0]['path'], 'README.md')
def test_(self): # commit 1 gitcommit = GitCommitHelper.commit(self.token, self.reponame, self.filenames, self.message) # commit 2 append_text_to_file(environ["MYHOME"] + "\\testpygithub\\git_test.txt", "foo") append_text_to_file( environ["MYHOME"] + "\\testpygithub\\git_test2.txt", "bar") gitcommit = GitCommitHelper.commit(self.token, self.reponame, self.filenames, self.message) # commit 3 self.filenames = [environ["MYHOME"] + "\\testpygithub\\git_test4.txt"] gitcommit = GitCommitHelper.commit(self.token, self.reponame, self.filenames, self.message) files = GitRepoHelper._get_files(self.repo) self.assertEqual(files, [ environ["MYHOME"] + '\\testpygithub\\git_test.txt', environ["MYHOME"] + '\\testpygithub\\git_test2.txt', environ["MYHOME"] + '\\testpygithub\\git_test3.txt', environ["MYHOME"] + '\\testpygithub\\git_test4.txt', u'README.md' ]) gitrepo = GitRepoHelper.history(self.token, self.reponame) self.assertEquals(gitrepo.commit_history[0][0]['content'], 'this is a testfoo') self.assertEquals(gitrepo.commit_history[0][1]['content'], 'this is a test2bar') self.assertEquals(gitrepo.commit_history[0][2]['content'], 'this is a test2') self.assertEquals(gitrepo.commit_history[0][3]['content'], 'this is a test4')
def _history(self, **kwargs): return GitRepoHelper.history(self.token, self.reponame, **kwargs).commit_history