def testDCOSignoffCheckMergeCommit(self): commit = Commit(self._mock_commit_merge, self._mock_repo) commit.git_commit_object.message = "has no signoff" self.assertTrue( commit.checkDCOSignoff(), "Commit message didn't have a signoff, but is a merge commit so that's ok" )
def testFoundNoPastDCOSignoff(self): commit = Commit(self._mock_commit, self._mock_repo) commit.git_commit_object.hexsha = 'c1d322dfba0ed7a770d74074990ac51a9efedcd0' commit.repo_object.past_signoffs = [ "I, personname hereby sign-off-by all of my past commits to this repo subject to the Developer Certificate of Origin (DCO), Version 1.1. In the past I have used emails: [[email protected]]\n\n11ac960e1070eacc2fe92ac9a3d1753400e1fd4b This is a commit" .encode() ] self.assertFalse(commit.hasDCOPastSignoff(), "Commit message had a past signoff")
def testDCOSignoffCheckNormalCommitNoSignoffPastSignoff(self): commit = Commit(self._mock_commit_merge, self._mock_repo) commit.git_commit_object.hexsha = '11ac960e1070eacc2fe92ac9a3d1753400e1fd4b' commit.repo_object.past_signoffs = [[ 'dco-signoffs', "I, personname hereby sign-off-by all of my past commits to this repo subject to the Developer Certificate of Origin (DCO), Version 1.1. In the past I have used emails: [[email protected]]\n\n11ac960e1070eacc2fe92ac9a3d1753400e1fd4b This is a commit" .encode() ]] commit.git_commit_object.message = "has no signoff" self.assertTrue( commit.checkDCOSignoff(), "Commit message didn't have a signoff, but it has a past DCO signoff so that's ok" )
def testDCOSignoffRequiredNormalCommit(self): commit = Commit(self._mock_commit, self._mock_repo) self.assertTrue(commit.isDCOSignOffRequired(), "All non-merge commits require a DCO signoff")
def testDCOSignoffRequiredMergeCommit(self): commit = Commit(self._mock_commit_merge, self._mock_repo) self.assertFalse(commit.isDCOSignOffRequired(), "Merge commits don't require a DCO signoff")
def testHasDCOSignOff(self): commit = Commit(self._mock_commit, self._mock_repo) commit.git_commit_object.message = "has a signoff Signed-off-by: John Mertic <*****@*****.**>" self.assertTrue(commit.hasDCOSignOff(), "Commit message had a signoff")
def testHasNoDCOSignOff(self): commit = Commit(self._mock_commit, self._mock_repo) commit.git_commit_object.message = "has no signoff" self.assertFalse(commit.hasDCOSignOff(), "Commit message didn't have a signoff")