[Kimchi-devel] [PATCHv2] issue#433: Fix fake url for repository test

Aline Manera alinefm at linux.vnet.ibm.com
Fri Sep 19 02:43:49 UTC 2014


Reviewed-by: Aline Manera <alinefm at linux.vnet.ibm.com>

On 09/18/2014 07:35 AM, lvroyce at linux.vnet.ibm.com wrote:
> 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 | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/tests/test_model.py b/tests/test_model.py
> index 0a709a7..123f031 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']}}]
>
>           repo_type = inst.capabilities_lookup()['repo_mngt_tool']
> @@ -1361,9 +1361,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/dist/'}
>
>           repo_type = inst.capabilities_lookup()['repo_mngt_tool']
>           if repo_type == 'yum':
> @@ -1395,7 +1395,7 @@ class ModelTests(unittest.TestCase):
>                                 repo_id, wrong_repo)
>
>           # update repositories with invalid mirrorlist
> -        for url in invalid_urls:
> +        for url in invalid_urls and repo_type == 'yum':
>               wrong_repo = {'config': {'mirrorlist': url}}
>               self.assertRaises(InvalidParameter, inst.repository_update,
>                                 repo_id, wrong_repo)
> @@ -1416,7 +1416,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']




More information about the Kimchi-devel mailing list