mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-12 16:56:15 +01:00
- added new testcases for #657838 ("osc 0.130: osc repairwc fails totally - working copy useless")
This commit is contained in:
parent
15178b6e4f
commit
fffd0c395a
@ -0,0 +1 @@
|
|||||||
|
urlwithoutprotocolandtld
|
@ -0,0 +1 @@
|
|||||||
|
<directory name="invalid_apiurl" rev="1" vrev="1" srcmd5="2738234914de5cc154b1494b1e98d940" />
|
11
tests/repairwc_fixtures/osctest/invalid_apiurl/.osc/_meta
Normal file
11
tests/repairwc_fixtures/osctest/invalid_apiurl/.osc/_meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<package project="remote" name="foo">
|
||||||
|
<title>Title of New Package</title>
|
||||||
|
<description>
|
||||||
|
LONG DESCRIPTION
|
||||||
|
GOES
|
||||||
|
HERE
|
||||||
|
</description>
|
||||||
|
<person userid="Admin" role="maintainer"/>
|
||||||
|
<person userid="Admin" role="bugowner"/>
|
||||||
|
<url>PUT_UPSTREAM_URL_HERE</url>
|
||||||
|
</package>
|
@ -0,0 +1 @@
|
|||||||
|
1.0
|
@ -0,0 +1 @@
|
|||||||
|
invalid_apiurl
|
@ -0,0 +1 @@
|
|||||||
|
remote
|
1
tests/repairwc_fixtures/prj_invalidapiurl/.osc/_apiurl
Normal file
1
tests/repairwc_fixtures/prj_invalidapiurl/.osc/_apiurl
Normal file
@ -0,0 +1 @@
|
|||||||
|
noschemeandnotld
|
1
tests/repairwc_fixtures/prj_invalidapiurl/.osc/_packages
Normal file
1
tests/repairwc_fixtures/prj_invalidapiurl/.osc/_packages
Normal file
@ -0,0 +1 @@
|
|||||||
|
<project name="prj_noapiurl" />
|
1
tests/repairwc_fixtures/prj_invalidapiurl/.osc/_project
Normal file
1
tests/repairwc_fixtures/prj_invalidapiurl/.osc/_project
Normal file
@ -0,0 +1 @@
|
|||||||
|
prj_invalidapiurl
|
@ -191,6 +191,15 @@ class TestRepairWC(OscTestCase):
|
|||||||
self.assertEqual(open(os.path.join('.osc', '_apiurl')).read(), 'http://localhost\n')
|
self.assertEqual(open(os.path.join('.osc', '_apiurl')).read(), 'http://localhost\n')
|
||||||
self.assertEqual(p.apiurl, 'http://localhost')
|
self.assertEqual(p.apiurl, 'http://localhost')
|
||||||
|
|
||||||
|
def test_invalidapiurl(self):
|
||||||
|
"""the package wc has an invalid apiurl file (invalid url format)"""
|
||||||
|
self._change_to_pkg('invalid_apiurl')
|
||||||
|
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):
|
def test_noapiurlNotExistingApiurl(self):
|
||||||
"""the package wc has no _apiurl file and no apiurl is passed to repairwc"""
|
"""the package wc has no _apiurl file and no apiurl is passed to repairwc"""
|
||||||
self._change_to_pkg('noapiurl')
|
self._change_to_pkg('noapiurl')
|
||||||
@ -212,6 +221,19 @@ class TestRepairWC(OscTestCase):
|
|||||||
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')
|
self.assertEqual(open(os.path.join(storedir, '_apiurl'), 'r').read(), 'http://localhost\n')
|
||||||
|
|
||||||
|
def test_project_invalidapiurl(self):
|
||||||
|
"""the project wc has an invalid _apiurl file (invalid url format)"""
|
||||||
|
import shutil
|
||||||
|
prj_dir = os.path.join(self.tmpdir, 'prj_invalidapiurl')
|
||||||
|
shutil.copytree(os.path.join(self._get_fixtures_dir(), 'prj_invalidapiurl'), 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__':
|
if __name__ == '__main__':
|
||||||
import unittest
|
import unittest
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
Loading…
Reference in New Issue
Block a user