1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-27 02:16:12 +01:00

add tests for commit messages and commit log

This commit is contained in:
Dr. Peter Poeml 2007-08-09 07:38:29 +00:00
parent d75d98da50
commit 043db4c43f

View File

@ -27,7 +27,7 @@ def remove_revid(s):
def checkout_and_clean(self):
"""check out the package and delete all files
"""check out the package and delete all files.
leave behind the empty package dir"""
runosc('co %s %s' % (PRJ, PAC))
chdir(TESTPACDIR)
@ -132,6 +132,60 @@ class TestOsc(unittest.TestCase):
self.assert_('openSUSE_Factory' in self.out)
#####################################################################
def testCommitMsg(self):
"""also tests the info and log commands"""
checkout_and_clean(self)
# ci -F
touch('foo')
runosc('add foo')
open('msgfile', 'w').write('message from file')
self.out, self.err = runosc('ci -F msgfile')
self.assertEqual(self.err, '')
self.out, self.err = runosc('info')
self.assertEqual(self.err, '')
self.assert_('Path: .\n' in self.out)
self.assert_('Repository UUID' in self.out)
self.assert_('Revision' in self.out)
lastrev = self.out[self.out.find('Revision') + 10 :].strip()
self.out, self.err = runosc('log -r %s' % lastrev)
self.assertEqual(self.err, '')
cl = self.out.splitlines()
self.assertEqual(len(cl), 5)
self.assert_(cl[1].startswith('r%s | poeml | ' % lastrev))
self.assertEqual(cl[2], '')
self.assertEqual(cl[3], 'message from file')
# ci -m
touch('bar')
runosc('add bar')
self.out, self.err = runosc('ci -m "message from commandline"')
self.assertEqual(self.err, '')
self.out, self.err = runosc('info')
self.assertEqual(self.err, '')
lastrev = self.out[self.out.find('Revision') + 10 :].strip()
self.out, self.err = runosc('log -r %s' % lastrev)
self.assertEqual(self.err, '')
cl = self.out.splitlines()
self.assertEqual(len(cl), 5)
self.assert_(cl[1].startswith('r%s | poeml | ' % lastrev))
self.assertEqual(cl[2], '')
self.assertEqual(cl[3], 'message from commandline')
#####################################################################
def testMerge(self):