1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-08-03 22:23:38 +02:00

- new testcase: repairwc: repair a project wc with no apiurl

This commit is contained in:
Marcus Huewe
2010-10-10 21:36:07 +02:00
parent cc29db4551
commit 48eaacef18
3 changed files with 15 additions and 0 deletions

View File

@@ -0,0 +1 @@
<project name="prj_noapiurl" />

View File

@@ -0,0 +1 @@
prj_noapiurl

View File

@@ -199,6 +199,19 @@ class TestRepairWC(OscTestCase):
self.assertRaises(osc.oscerr.WorkingCopyInconsistent, p.wc_repair)
self.assertFalse(os.path.exists(os.path.join('.osc', '_apiurl')))
def test_project_noapiurl(self):
"""the project wc has no _apiurl file"""
import shutil
prj_dir = os.path.join(self.tmpdir, 'prj_noapiurl')
shutil.copytree(os.path.join(self._get_fixtures_dir(), 'prj_noapiurl'), prj_dir)
storedir = os.path.join(prj_dir, osc.core.store)
self.assertRaises(osc.oscerr.WorkingCopyInconsistent, osc.core.Project, prj_dir, getPackageList=False)
prj = osc.core.Project(prj_dir, wc_check=False, getPackageList=False)
prj.wc_repair('http://localhost')
self.assertTrue(os.path.exists(os.path.join(storedir, '_apiurl')))
self.assertTrue(os.path.exists(os.path.join(storedir, '_apiurl')))
self.assertEqual(open(os.path.join(storedir, '_apiurl'), 'r').read(), 'http://localhost\n')
if __name__ == '__main__':
import unittest
unittest.main()