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:
parent
67c07e38c0
commit
c3c75689ef
5
tests/repairwc_fixtures/osctest/noapiurl/.osc/_files
Normal file
5
tests/repairwc_fixtures/osctest/noapiurl/.osc/_files
Normal 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>
|
@ -0,0 +1 @@
|
||||
nochange
|
@ -0,0 +1 @@
|
||||
1.0
|
1
tests/repairwc_fixtures/osctest/noapiurl/.osc/_package
Normal file
1
tests/repairwc_fixtures/osctest/noapiurl/.osc/_package
Normal file
@ -0,0 +1 @@
|
||||
noapiurl
|
1
tests/repairwc_fixtures/osctest/noapiurl/.osc/_project
Normal file
1
tests/repairwc_fixtures/osctest/noapiurl/.osc/_project
Normal file
@ -0,0 +1 @@
|
||||
osctest
|
@ -0,0 +1 @@
|
||||
foobar
|
@ -0,0 +1 @@
|
||||
foo
|
1
tests/repairwc_fixtures/osctest/noapiurl/.osc/foo
Normal file
1
tests/repairwc_fixtures/osctest/noapiurl/.osc/foo
Normal file
@ -0,0 +1 @@
|
||||
This is a simple test.
|
4
tests/repairwc_fixtures/osctest/noapiurl/.osc/merge
Normal file
4
tests/repairwc_fixtures/osctest/noapiurl/.osc/merge
Normal file
@ -0,0 +1,4 @@
|
||||
Is it
|
||||
possible to
|
||||
merge this file?
|
||||
I hope so...
|
1
tests/repairwc_fixtures/osctest/noapiurl/.osc/nochange
Normal file
1
tests/repairwc_fixtures/osctest/noapiurl/.osc/nochange
Normal file
@ -0,0 +1 @@
|
||||
This file didn't change.
|
0
tests/repairwc_fixtures/osctest/noapiurl/foobar
Normal file
0
tests/repairwc_fixtures/osctest/noapiurl/foobar
Normal file
4
tests/repairwc_fixtures/osctest/noapiurl/merge
Normal file
4
tests/repairwc_fixtures/osctest/noapiurl/merge
Normal file
@ -0,0 +1,4 @@
|
||||
Is it
|
||||
possible to
|
||||
merge this file?
|
||||
I hope so...
|
2
tests/repairwc_fixtures/osctest/noapiurl/nochange
Normal file
2
tests/repairwc_fixtures/osctest/noapiurl/nochange
Normal file
@ -0,0 +1,2 @@
|
||||
This file didn't change but
|
||||
is modified.
|
1
tests/repairwc_fixtures/osctest/noapiurl/toadd1
Normal file
1
tests/repairwc_fixtures/osctest/noapiurl/toadd1
Normal file
@ -0,0 +1 @@
|
||||
toadd1
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user