def test_(self): repohelper = GitExcelHelper.action_type(self.filename,"commit") commits = GitRepoHelper._get_commits(repohelper.gitcommit.repo) details = GitRepoHelper._get_commit_details(repohelper.gitcommit.repo,commits) self.assertEquals(details[0][1]['content'],'this is a test') self.assertEquals(details[0][3]['content'],'this is a test2') self.assertEquals(details[1][0]['content'],'# testpygithub')
def test_(self): commits = GitRepoHelper._get_commits(self.repo) details = GitRepoHelper._get_commit_details(self.repo, commits) self.assertEquals(details[0][0]['content'], 'this is a test') self.assertEquals(details[0][2]['content'], 'this is a test2') self.assertEquals(details[1][0]['content'], '# testpygithub') '''
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 setUp(self): sleep(5) self.token = GitBase._get_token() self.reponame = "testpygithub" self.github = GitBase._login(self.token) self.user = GitBase._get_user(self.github) sleep(1) self.repo = GitRepoHelper._create_repo(self.user, self.reponame, auto_init=True) sleep(1)
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 setUp(self): super(Test_GitHistory,self).setUp() self.filename = "uupyshell.txt" self.encoding = "uu" self.user = GitBase._get_user(self.github) self.repo = GitRepoHelper._create_repo(self.user,self.reponame,auto_init=True) write_text_to_file(self.filename,"token:"+encode(self.token,self.encoding) + "\n") append_text_to_file(self.filename,"reponame:"+encode(self.reponame,self.encoding) + "\n") append_text_to_file(self.filename,"gitrootpath:"+encode(self.gitrootpath,self.encoding) + "\n") append_text_to_file(self.filename,"commit_message:"+encode(self.commit_message,self.encoding) + "\n") append_text_to_file(self.filename,"commit_files:"+"$$".join([encode(_file,self.encoding) for _file in self.commit_files]) + "\n") GitCommitHelper.commit(self.token,self.reponame,self.commit_files,self.commit_message)
def setUp(self): super(Test_GitCommit2Levels,self).setUp() self.commit_files = self.commit_files + ["C:\\Users\\burtnolej\\testpygithub\\test\\git_test5.txt", "C:\\Users\\burtnolej\\testpygithub\\test\\git_test6.txt"] self.filename = "uupyshell.txt" self.encoding = "uu" self.user = GitBase._get_user(self.github) self.repo = GitRepoHelper._create_repo(self.user,self.reponame,auto_init=True) write_text_to_file(self.filename,"token:"+encode(self.token,self.encoding) + "\n") append_text_to_file(self.filename,"reponame:"+encode(self.reponame,self.encoding) + "\n") append_text_to_file(self.filename,"gitrootpath:"+encode(self.gitrootpath,self.encoding) + "\n") append_text_to_file(self.filename,"commit_message:"+encode(self.commit_message,self.encoding) + "\n") append_text_to_file(self.filename,"commit_files:"+"$$".join([encode(_file,self.encoding) for _file in self.commit_files]) + "\n")
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 _validate_commit_files(self, **kwargs): encoding = "unicode" if kwargs.has_key("encoding"): encoding = kwargs['encoding'] if hasattr(self, "commit_files") == False: log.log(PRIORITY.FAILURE, msg="commit_files must be passed") return ([-1]) else: if self._validate_filename("commit_files", encoding=encoding) != [-1]: files = getattr(self, "commit_files") files = GitRepoHelper._get_git_rel_filepath( self.reponame, files, decode(self.gitrootpath[0], encoding)) setattr(self, "commit_files", files) else: raise Exception("could not validate commit_files")
def setUp(self): self.token = GitBase._get_token() self.reponame = "testpygithub" self.github = GitBase._login(self.token) self.user = GitBase._get_user(self.github) self.repo = GitRepoHelper._create_repo(self.user, self.reponame, auto_init=True) self.filenames = [ environ["MYHOME"] + "\\testpygithub\\git_test.txt", environ["MYHOME"] + "\\testpygithub\\git_test2.txt", environ["MYHOME"] + "\\testpygithub\\git_test3.txt" ] self.tree = GitCommitHelper._create_input_tree_multi( self.filenames, self.repo) self.parents = [GitCommitHelper._get_last_commit(self.repo)] self.new_commit = GitCommitHelper._create_commit( self.repo, "commit via pyyhon api", self.tree, self.parents) self.headref = GitCommitHelper._get_ref(self.repo) self.headref.edit(self.new_commit.sha)
def tearDown(self): GitRepoHelper._delete_repo(self.repo) del self.github
def test_(self): gitcommit = GitRepoHelper._get_last_commit(self.repo) self.assertEquals(GitRepoHelper._get_file_path(gitcommit), "README.md") content = GitRepoHelper._get_file_content(self.repo, gitcommit) self.assertEquals(b64decode(content), "# testpygithub")
def tearDown(self): GitRepoHelper._delete_repo(self.repo) del self.github chdir(self.cwd) os_file_delete(path.join(ROOTDIR,self.filename))
def _create_repo(self): return GitRepoHelper.new(self.token, self.username, self.reponame).repo
def _delete(self): return GitRepoHelper.delete(self.token, self.reponame)
def _history(self, **kwargs): return GitRepoHelper.history(self.token, self.reponame, **kwargs).commit_history
def test_(self): gitcommit = GitRepoHelper._get_last_commit(self.repo) self.assertIsInstance(gitcommit, GitCommit.GitCommit)
def test_(self): repohelper = GitExcelHelper.action_type(self.filename,"commit") commits = GitRepoHelper._get_commits(repohelper.gitcommit.repo) details = GitRepoHelper._get_commit_details(repohelper.gitcommit.repo,commits) self.assertEquals(details[0][4]['content'],'this is a test5') self.assertEquals(details[0][4]['path'],u'test/git_test5.txt')
def test_(self): self.repo = GitRepoHelper._create_repo(self.user, self.reponame) self.assertIsInstance(self.repo, Repository.Repository)
def test_(self): gitrepo = GitRepoHelper(self.token, self.reponame) self.assertIsInstance(gitrepo.repo, Repository.Repository)
def test_(self): newrepo = GitRepoHelper._get_repo(self.user, self.reponame) self.assertIsInstance(newrepo, Repository.Repository)
def test_(self): #ref = self.repo.get_ref("heads/master") ref = GitRepoHelper._get_ref(self.repo) self.assertIsInstance(ref, GitRef.GitRef)