[Kimchi-devel] [PATCH][Kimchi 2/2] Create test to verify graphics type change

Aline Manera alinefm at linux.vnet.ibm.com
Tue Aug 30 16:23:36 UTC 2016


Please, also add tests to cover the new API.
You can add the tests in test_rest.py file.

On 08/23/2016 01:47 PM, Ramon Medeiros wrote:
> Signed-off-by: Ramon Medeiros <ramonn at linux.vnet.ibm.com>
> ---
>   tests/test_model.py | 18 +++++++-----------
>   1 file changed, 7 insertions(+), 11 deletions(-)
>
> diff --git a/tests/test_model.py b/tests/test_model.py
> index e77d4fd..45498e7 100644
> --- a/tests/test_model.py
> +++ b/tests/test_model.py
> @@ -324,25 +324,21 @@ class ModelTests(unittest.TestCase):
>                     'source_media': {'type': 'disk', 'path': UBUNTU_ISO}}
>           inst.templates_create(params)
>           with RollbackContext() as rollback:
> -            params = {'name': 'kimchi-vnc',
> +            params = {'name': 'kimchi-graphics',
>                         'template': '/plugins/kimchi/templates/test'}
>               task1 = inst.vms_create(params)
>               inst.task_wait(task1['id'])
> -            rollback.prependDefer(inst.vm_delete, 'kimchi-vnc')
> +            rollback.prependDefer(inst.vm_delete, 'kimchi-graphics')
>
> -            info = inst.vm_lookup('kimchi-vnc')
> +            info = inst.vm_lookup('kimchi-graphics')
>               self.assertEquals('vnc', info['graphics']['type'])
>               self.assertEquals('127.0.0.1', info['graphics']['listen'])
>
> -            graphics = {'type': 'spice', 'listen': '127.0.0.1'}
> -            params = {'name': 'kimchi-spice',
> -                      'template': '/plugins/kimchi/templates/test',
> -                      'graphics': graphics}
> -            task2 = inst.vms_create(params)
> -            inst.task_wait(task2['id'])
> -            rollback.prependDefer(inst.vm_delete, 'kimchi-spice')
> +            graphics = {'type': 'spice'}
> +            params = {'graphics': graphics}
> +            inst.vm_update('kimchi-graphics', params)
>
> -            info = inst.vm_lookup('kimchi-spice')
> +            info = inst.vm_lookup('kimchi-graphics')
>               self.assertEquals('spice', info['graphics']['type'])
>               self.assertEquals('127.0.0.1', info['graphics']['listen'])
>




More information about the Kimchi-devel mailing list