def testTrailingNewlines(self): # Make sure trailing newlines get chomped. self._writelines(self.changelog, ['#\n', 'foo\n', '\n', 'bar\n', '\n', '\n']) UpdateChangeLog(self.pkgdir, self.user, 'test!', self.skel_changelog, self.cat, self.pkg, quiet=True) actual_cl = self._readlines(self.changelog) self.assertNotEqual(actual_cl[-1], '\n')
def testExistingBadHeader(self): # Test existing ChangeLog (wrong values) self._writelines(self.changelog, ['# ChangeLog for \n']) UpdateChangeLog(self.pkgdir, self.user, 'test!', self.skel_changelog, self.cat, self.pkg, quiet=True) actual_cl = self._readlines(self.changelog) self.assertEqual(actual_cl[0], self.header_pkg)
def testEmptyChangeLog(self): # Make sure we do the right thing with a 0-byte ChangeLog open(self.changelog, 'w').close() UpdateChangeLog(self.pkgdir, self.user, 'test!', self.skel_changelog, self.cat, self.pkg, quiet=True) actual_cl = self._readlines(self.changelog) self.assertEqual(actual_cl[0], self.header_pkg) self.assertEqual(actual_cl[1], self.header_copyright) self.assertEqual(actual_cl[2], self.header_cvs)
def testRejectRootUser(self): self.assertEqual( UpdateChangeLog(self.pkgdir, 'me <*****@*****.**>', '', '', '', '', quiet=True), None)
def testCopyrightUpdate(self): # Make sure updating the copyright line works UpdateChangeLog(self.pkgdir, self.user, 'test!', self.skel_changelog, self.cat, self.pkg, quiet=True) actual_cl = self._readlines(self.changelog) self.assertEqual(actual_cl[1], self.header_copyright)
def testMissingSkelFile(self): # Test missing ChangeLog, but with empty skel (i.e. do nothing). UpdateChangeLog(self.pkgdir, self.user, 'test!', '/does/not/exist', self.cat, self.pkg, quiet=True) actual_cl = self._readlines(self.changelog) self.assertTrue(len(actual_cl[0]) > 0)
def testSkelHeader(self): # Test skel.ChangeLog -> ChangeLog UpdateChangeLog(self.pkgdir, self.user, 'test!', self.skel_changelog, self.cat, self.pkg, quiet=True) actual_cl = self._readlines(self.changelog) self.assertEqual(actual_cl[0], self.header_pkg) self.assertNotEqual(actual_cl[-1], '\n')
def testExistingGoodHeader(self): # Test existing ChangeLog (correct values) self._writelines(self.changelog, [self.header_pkg]) UpdateChangeLog( self.pkgdir, self.user, "test!", self.skel_changelog, self.cat, self.pkg, quiet=True, ) actual_cl = self._readlines(self.changelog) self.assertEqual(actual_cl[0], self.header_pkg)
def testTrailingNewlines(self): # Make sure trailing newlines get chomped. self._writelines(self.changelog, ["#\n", "foo\n", "\n", "bar\n", "\n", "\n"]) UpdateChangeLog( self.pkgdir, self.user, "test!", self.skel_changelog, self.cat, self.pkg, quiet=True, ) actual_cl = self._readlines(self.changelog) self.assertNotEqual(actual_cl[-1], "\n")