[Kimchi-devel] [PATCH] Fix test cases on test_authorization.py

Paulo Ricardo Paz Vital pvital at linux.vnet.ibm.com
Tue Oct 13 23:21:28 UTC 2015


Reviewed-By: Paulo Vital <pvital at linux.vnet.ibm.com>

On Tue, 2015-10-13 at 19:12 -0300, Aline Manera wrote:
> Some test cases were failing due the changes with Wok and Kimchi as a
> plugin.
> The task API is part of Wok framework and the tests were updated
> accordingly.
> 
> Signed-off-by: Aline Manera <alinefm at linux.vnet.ibm.com>
> ---
>  src/wok/plugins/kimchi/tests/test_authorization.py | 14 +++++++++---
> --
>  1 file changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/src/wok/plugins/kimchi/tests/test_authorization.py
> b/src/wok/plugins/kimchi/tests/test_authorization.py
> index 87d68ab..7134311 100644
> --- a/src/wok/plugins/kimchi/tests/test_authorization.py
> +++ b/src/wok/plugins/kimchi/tests/test_authorization.py
> @@ -22,6 +22,7 @@ import os
>  import unittest
>  from functools import partial
> 
> +from wok.model.model import Model
>  from wok.plugins.kimchi import mockmodel
> 
>  from iso_gen import construct_fake_iso
> @@ -31,6 +32,7 @@ from utils import run_server, wait_task
> 
>  test_server = None
>  model = None
> +wok_model = None
>  host = None
>  port = None
>  ssl_port = None
> @@ -38,10 +40,12 @@ fake_iso = '/tmp/fake.iso'
> 
> 
>  def setUpModule():
> -    global test_server, model, host, port, ssl_port
> +    global test_server, model, wok_model, host, port, ssl_port
> 
>      patch_auth(sudo=False)
>      model = mockmodel.MockModel('/tmp/obj-store-test')
> +    wok_model = Model('/tmp/obj-store-test')
> +
>      host = '127.0.0.1'
>      port = get_free_port('http')
>      ssl_port = get_free_port('https')
> @@ -125,7 +129,7 @@ class AuthorizationTests(unittest.TestCase):
>              'name': u'test-me',
>              'template': '/plugins/kimchi/templates/test'
>          })
> -        wait_task(model.task_lookup, task_info['id'])
> +        wait_task(wok_model.task_lookup, task_info['id'])
> 
>          model.vm_update(u'test-me',
>                          {'users': [mockmodel.fake_user.keys()[0]],
> @@ -135,7 +139,7 @@ class AuthorizationTests(unittest.TestCase):
>              'name': u'test-usera',
>              'template': '/plugins/kimchi/templates/test'
>          })
> -        wait_task(model.task_lookup, task_info['id'])
> +        wait_task(wok_model.task_lookup, task_info['id'])
> 
>          non_root = list(set(model.users_get_list()) -
> set(['root']))[0]
>          model.vm_update(u'test-usera', {'users': [non_root],
> 'groups': []})
> @@ -144,7 +148,7 @@ class AuthorizationTests(unittest.TestCase):
>              'name': u'test-groupa',
>              'template': '/plugins/kimchi/templates/test'
>          })
> -        wait_task(model.task_lookup, task_info['id'])
> +        wait_task(wok_model.task_lookup, task_info['id'])
>          a_group = model.groups_get_list()[0]
>          model.vm_update(u'test-groupa', {'groups': [a_group]})
> 
> @@ -161,7 +165,7 @@ class AuthorizationTests(unittest.TestCase):
>              'name': 'kimchi-test',
>              'template': '/plugins/kimchi/templates/test'
>          })
> -        wait_task(model.task_lookup, task_info['id'])
> +        wait_task(wok_model.task_lookup, task_info['id'])
>          resp = self.request('/plugins/kimchi/vms/kimchi-test', '{}',
> 'PUT')
>          self.assertEquals(403, resp.status)
>          resp = self.request('/plugins/kimchi/vms/kimchi-test', '{}',
> 'DELETE')




More information about the Kimchi-devel mailing list