[Kimchi-devel] [PATCH 2/2] Fix testcases for repository config param

Aline Manera alinefm at linux.vnet.ibm.com
Fri Sep 19 03:10:52 UTC 2014


On 09/17/2014 07:35 AM, lvroyce at linux.vnet.ibm.com wrote:
> From: Royce Lv <lvroyce at linux.vnet.ibm.com>
>
> Update according testcases which pass unexpected params to apt
>
> Signed-off-by: Royce Lv <lvroyce at linux.vnet.ibm.com>
> ---
>   tests/test_model.py | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/tests/test_model.py b/tests/test_model.py
> index ceedc6f..0a709a7 100644
> --- a/tests/test_model.py
> +++ b/tests/test_model.py
> @@ -1318,10 +1318,11 @@ class ModelTests(unittest.TestCase):
>               self.assertRaises(InvalidParameter, inst.repositories_create, repo)
>
>           # create repositories with invalid mirrorlist
> -        for url in invalid_urls:
> -            repo = {'repo_id': 'repo_fake',
> -                    'config': {'mirrorlist': url, 'dist': 'quantal'}}
> -            self.assertRaises(InvalidParameter, inst.repositories_create, repo)
> +        if repo_type == 'yum':
> +            for url in invalid_urls:
> +                repo = {'repo_id': 'repo_fake',
> +                        'config': {'mirrorlist': url, 'dist': 'quantal'}}
> +                self.assertRaises(InvalidParameter, inst.repositories_create, repo)

Instead of restricting the test for "yum" I suggest creating invalid 
inputs according to repository manager (like we did for valid config)

Something like below:

yum_invalid_params = {'repo_id': 'repo_fake',
                                      'baseurl': url,
                                      'config': {'dist': 'quantal'}}

deb_invalid_params = {'repo_id': 'repo_fake',
                                      'config': {'mirrorlist': url, 
'dist': 'quantal'}}

         if repo_type == 'yum':
             test_repos = yum_repos
             invalid_params = yum_invalid_params
         elif repo_type == 'deb':
             test_repos = deb_repos
             invalid_params = deb_invalid_params
else:
             # repository management tool was not recognized by Kimchi
             # skip test case
             return



>           for repo in test_repos:
>               system_host_repos = len(inst.repositories_get_list())




More information about the Kimchi-devel mailing list