1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-09 22:36:14 +01:00

- test_deletefiles.py: new testcases for skipped files

This commit is contained in:
Marcus Huewe 2011-01-17 14:59:46 +01:00
parent 7b08d6c4a3
commit 6132f89268
3 changed files with 26 additions and 1 deletions

View File

@ -2,4 +2,6 @@
<entry md5="0d62ceea6020d75154078a20d8c9f9ba" mtime="1282047302" name="foo" size="23" />
<entry md5="17b9e9e1a032ed44e7a584dc6303ffa8" mtime="1282047303" name="merge" size="48" />
<entry md5="7efa70f68983fad1cf487f69dedf93e9" mtime="1282047303" name="nochange" size="25" />
<entry md5="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" mtime="123456789" name="skipped" size="225" skipped="true" />
<entry md5="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" mtime="012345678" name="skipped_exists" size="22" skipped="true" />
</directory>

View File

@ -0,0 +1 @@
foobar

View File

@ -175,6 +175,28 @@ class TestDeleteFiles(OscTestCase):
self._check_deletelist('foo\n')
self.assertFalse(os.path.exists(os.path.join('.osc', '_to_be_added')))
def testDeleteSkippedLocalNotExistent(self):
"""
delete a skipped file: no local file with that name exists
"""
self._change_to_pkg('simple')
p = osc.core.Package('.')
ret = p.delete_file('skipped')
self.__check_ret(ret, False, 'S')
self.assertFalse(os.path.exists(os.path.join('.osc', '_to_be_deleted')))
def testDeleteSkippedLocalExistent(self):
"""
delete a skipped file: a local file with that name exists and will be deleted
(for instance _service:* files have status 'S' but a local files might exist)
"""
self._change_to_pkg('simple')
p = osc.core.Package('.')
ret = p.delete_file('skipped_exists')
self.__check_ret(ret, True, 'S')
self.assertFalse(os.path.exists('skipped_exists'))
self.assertFalse(os.path.exists(os.path.join('.osc', '_to_be_deleted')))
def __check_ret(self, ret, exp1, exp2):
self.assertTrue(len(ret) == 2)
self.assertTrue(ret[0] == exp1)