def testOneCommit(self): self._createCommitNewFile("README") hashes = phlgit_log.get_range_to_here_hashes(self.repo, "HEAD") self.assertIsNotNone(hashes) self.assertTrue(not hashes) self.assertIsInstance(hashes, list) head = phlgit_log.get_last_commit_hash(self.repo) self.assertIsNotNone(head) head2 = phlgit_log.get_last_n_commit_hashes(self.repo, 1) self.assertIsNotNone(head2) self.assertEqual(head, head2[0]) self.assertListEqual( phlgit_log.get_last_n_commit_hashes(self.repo, 0), []) self.assertRaises( ValueError, phlgit_log.get_last_n_commit_hashes, self.repo, 2)
def testTwoCommits(self): self._createCommitNewFile("README") self._createCommitNewFile("README2") head = phlgit_log.get_last_commit_hash(self.repo) self.assertIsNotNone(head) hashes = phlgit_log.get_last_n_commit_hashes(self.repo, 2) self.assertIsNotNone(hashes) self.assertEqual(head, hashes[-1]) self.assertListEqual(hashes, hashes)