[Kimchi-devel] [PATCHv2 2/3] issue#433: Fix fake url for repository test
lvroyce at linux.vnet.ibm.com
lvroyce at linux.vnet.ibm.com
Mon Sep 22 09:32:24 UTC 2014
From: Royce Lv <lvroyce at linux.vnet.ibm.com>
When using apt, the base url needs to be validated,
a fake url will be rejected by kimchi, causing:
Traceback (most recent call last):
File "../kimchi/tests/test_model.py", line 1443, in test_repository_disable_enable
repo_id = inst.repositories_create(repo)
File "../kimchi/src/kimchi/model/host.py", line 406, in create
return self.host_repositories.addRepository(params)
File "../kimchi/src/kimchi/repositories.py", line 54, in addRepository
return self._pkg_mnger.addRepo(params)
File "../kimchi/src/kimchi/repositories.py", line 426, in addRepo
validate_repo_url(uri)
File "../kimchi/src/kimchi/utils.py", line 307, in validate_repo_url
raise InvalidParameter("KCHUTILS0001E", {'uri': url})
InvalidParameter: KCHUTILS0001E: Invalid URI http://br.archive.ubuntu.com/kimchi/fake
So give a valid url in testcase instead of a fake one.
Signed-off-by: Royce Lv <lvroyce at linux.vnet.ibm.com>
---
tests/test_model.py | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/tests/test_model.py b/tests/test_model.py
index 56a8e12..4e517c1 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -1290,9 +1290,9 @@ class ModelTests(unittest.TestCase):
{'mirrorlist': 'http://www.fedoraproject.org',
'gpgkey': 'file:///tmp/KEY-fedora-updates-fake-19'}}]
- deb_repos = [{'baseurl': 'http://br.archive.ubuntu.com/kimchi/fake',
+ deb_repos = [{'baseurl': 'http://br.archive.ubuntu.com/ubuntu/',
'config': {'dist': 'quantal'}},
- {'baseurl': 'http://br.archive.kimchi.com/ubuntu/fake',
+ {'baseurl': 'http://br.archive.ubuntu.com/ubuntu/',
'config': {'dist': 'quantal', 'comps': ['main']}}]
invalid_deb_repo = {'baseurl': 'http://br.archive.ubuntu.com/ubuntu/',
@@ -1374,9 +1374,9 @@ class ModelTests(unittest.TestCase):
'baseurl': 'http://www.fedora.org'}
yum_new_repo = {'baseurl': 'http://www.fedoraproject.org'}
- deb_repo = {'baseurl': 'http://br.archive.ubuntu.com/kimchi/fake',
+ deb_repo = {'baseurl': 'http://br.archive.ubuntu.com/ubuntu/',
'config': {'dist': 'quantal'}}
- deb_new_repo = {'baseurl': 'http://archive.canonical.com/kimchi'}
+ deb_new_repo = {'baseurl': 'http://archive.canonical.com/dists/'}
repo_type = inst.capabilities_lookup()['repo_mngt_tool']
if repo_type == 'yum':
@@ -1408,10 +1408,11 @@ class ModelTests(unittest.TestCase):
repo_id, wrong_repo)
# update repositories with invalid mirrorlist
- for url in invalid_urls:
- wrong_repo = {'config': {'mirrorlist': url}}
- self.assertRaises(InvalidParameter, inst.repository_update,
- repo_id, wrong_repo)
+ if repo_type == 'yum':
+ for url in invalid_urls:
+ wrong_repo = {'config': {'mirrorlist': url}}
+ self.assertRaises(InvalidParameter, inst.repository_update,
+ repo_id, wrong_repo)
new_repo_id = inst.repository_update(repo_id, new_repo)
repo_info = inst.repository_lookup(new_repo_id)
@@ -1429,7 +1430,7 @@ class ModelTests(unittest.TestCase):
yum_repo = {'repo_id': 'fedora-fake',
'baseurl': 'http://www.fedora.org'}
- deb_repo = {'baseurl': 'http://br.archive.ubuntu.com/kimchi/fake',
+ deb_repo = {'baseurl': 'http://br.archive.ubuntu.com/ubuntu/',
'config': {'dist': 'quantal'}}
repo_type = inst.capabilities_lookup()['repo_mngt_tool']
--
1.8.3.2
More information about the Kimchi-devel
mailing list