[Kimchi-devel] [PATCH 2/2 V2] Adds tests to check disk format information in new templates
Aline Manera
alinefm at linux.vnet.ibm.com
Fri Apr 17 17:15:05 UTC 2015
Reviewed-by: Aline Manera <alinefm at linux.vnet.ibm.com>
On 16/04/2015 15:54, Rodrigo Trujillo wrote:
> This patch adds two tests to check if templates are being created with
> default disk format value (qcow2) or if the template is being created
> correctly with the format value passed.
> Template update tests already exist.
>
> Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
> ---
> tests/test_template.py | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/tests/test_template.py b/tests/test_template.py
> index 4446025..23a24fb 100644
> --- a/tests/test_template.py
> +++ b/tests/test_template.py
> @@ -86,6 +86,9 @@ class TemplateTests(unittest.TestCase):
> tmpl = json.loads(self.request('/templates/test').read())
> self.assertEquals(sorted(tmpl.keys()), sorted(keys))
>
> + # Verify if default disk format was configured
> + self.assertEquals(tmpl['disks'][0]['format'], 'qcow2')
> +
> # Clone a template
> resp = self.request('/templates/test/clone', '{}', 'POST')
> self.assertEquals(303, resp.status)
> @@ -113,6 +116,15 @@ class TemplateTests(unittest.TestCase):
> self.assertEquals(201, resp.status)
> os.remove('/tmp/mock.img')
>
> + # Test disk format
> + t = {'name': 'test-format', 'cdrom': '/tmp/mock.iso',
> + 'disks': [{'index': 0, 'size': 10, 'format': 'vmdk'}]}
> + req = json.dumps(t)
> + resp = self.request('/templates', req, 'POST')
> + self.assertEquals(201, resp.status)
> + tmpl = json.loads(self.request('/templates/test-format').read())
> + self.assertEquals(tmpl['disks'][0]['format'], 'vmdk')
> +
> def test_customized_tmpl(self):
> # Create a template
> t = {'name': 'test', 'cdrom': '/tmp/mock.iso'}
More information about the Kimchi-devel
mailing list