[Kimchi-devel] [PATCH 2/5] Update tests to account for proper JSON being returned in vm stats.

Sheldon shaohef at linux.vnet.ibm.com
Thu Feb 20 03:03:17 UTC 2014


Reviewed-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>

On 02/20/2014 06:10 AM, Adam King wrote:
> Updated model and mockmodel tests to account for JSON responses in place of the string responses that were returned before.
>
> Signed-off-by: Adam King <rak at linux.vnet.ibm.com>
> ---
>   tests/test_mockmodel.py | 2 +-
>   tests/test_model.py     | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tests/test_mockmodel.py b/tests/test_mockmodel.py
> index 4ac08dd..ab5eb59 100644
> --- a/tests/test_mockmodel.py
> +++ b/tests/test_mockmodel.py
> @@ -149,7 +149,7 @@ class MockModelTests(unittest.TestCase):
>           self.assertEquals(1024, info['memory'])
>           self.assertEquals(1, info['cpus'])
>           self.assertEquals('images/icon-vm.png', info['icon'])
> -        self.assertEquals(stats_keys, set(eval(info['stats']).keys()))
> +        self.assertEquals(stats_keys, set(info['stats'].keys()))
>           self.assertEquals('vnc', info['graphics']['type'])
>           self.assertEquals('0.0.0.0', info['graphics']['listen'])
>
> diff --git a/tests/test_model.py b/tests/test_model.py
> index 298a39e..d3315a0 100644
> --- a/tests/test_model.py
> +++ b/tests/test_model.py
> @@ -67,7 +67,7 @@ class ModelTests(unittest.TestCase):
>           self.assertEquals(2048, info['memory'])
>           self.assertEquals(2, info['cpus'])
>           self.assertEquals(None, info['icon'])
> -        self.assertEquals(stats_keys, set(eval(info['stats']).keys()))
> +        self.assertEquals(stats_keys, set(info['stats'].keys()))
>           self.assertRaises(NotFoundError, inst.vm_lookup, 'nosuchvm')
>
>       @unittest.skipUnless(utils.running_as_root(), 'Must be run as root')


-- 
Thanks and best regards!

Sheldon Feng(冯少合)<shaohef at linux.vnet.ibm.com>
IBM Linux Technology Center




More information about the Kimchi-devel mailing list