1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-25 17:36:13 +01:00

- added testcases for repairwc in order to repair a wc if the "_apiurl" file is missing

This commit is contained in:
Marcus Huewe 2010-09-28 23:01:39 +02:00
parent 67c07e38c0
commit c3c75689ef
15 changed files with 41 additions and 2 deletions

View File

@ -0,0 +1,5 @@
<directory name="noapiurl" rev="1" srcmd5="2df1eacfe03a3bec2112529e7f4dc39a" vrev="1">
<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" />
</directory>

View File

@ -0,0 +1 @@
nochange

View File

@ -0,0 +1 @@
1.0

View File

@ -0,0 +1 @@
noapiurl

View File

@ -0,0 +1 @@
osctest

View File

@ -0,0 +1 @@
foobar

View File

@ -0,0 +1 @@
foo

View File

@ -0,0 +1 @@
This is a simple test.

View File

@ -0,0 +1,4 @@
Is it
possible to
merge this file?
I hope so...

View File

@ -0,0 +1 @@
This file didn't change.

View File

@ -0,0 +1,4 @@
Is it
possible to
merge this file?
I hope so...

View File

@ -0,0 +1,2 @@
This file didn't change but
is modified.

View File

@ -0,0 +1 @@
toadd1

View File

@ -10,8 +10,6 @@ def suite():
import unittest
return unittest.makeSuite(TestRepairWC)
rev_dummy = '<revision rev="repository">\n <srcmd5>empty</srcmd5>\n</revision>'
class TestRepairWC(OscTestCase):
def _get_fixtures_dir(self):
return FIXTURES_DIR
@ -184,6 +182,23 @@ class TestRepairWC(OscTestCase):
# additional cleanup check
self.__assertNotRaises(osc.oscerr.WorkingCopyInconsistent, osc.core.Package, '.')
def test_noapiurl(self):
"""the package wc has no _apiurl file"""
self._change_to_pkg('noapiurl')
p = osc.core.Package('.', wc_check=False)
p.wc_repair('http://localhost')
self.assertTrue(os.path.exists(os.path.join('.osc', '_apiurl')))
self.assertEqual(open(os.path.join('.osc', '_apiurl')).read(), 'http://localhost\n')
self.assertEqual(p.apiurl, 'http://localhost')
def test_noapiurlNotExistingApiurl(self):
"""the package wc has no _apiurl file and no apiurl is passed to repairwc"""
self._change_to_pkg('noapiurl')
self.assertRaises(osc.oscerr.WorkingCopyInconsistent, osc.core.Package, '.')
p = osc.core.Package('.', wc_check=False)
self.assertRaises(osc.oscerr.WorkingCopyInconsistent, p.wc_repair)
self.assertFalse(os.path.exists(os.path.join('.osc', '_apiurl')))
if __name__ == '__main__':
import unittest
unittest.main()