[Kimchi-devel] [PATCH 5/5] clone template: update test case
shaohef at linux.vnet.ibm.com
shaohef at linux.vnet.ibm.com
Tue Feb 11 13:58:14 UTC 2014
From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
update test_rest.py
Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
---
tests/test_rest.py | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/tests/test_rest.py b/tests/test_rest.py
index 0ed293b..5953f18 100644
--- a/tests/test_rest.py
+++ b/tests/test_rest.py
@@ -818,6 +818,40 @@ class RestTests(unittest.TestCase):
resp = self.request('/templates', req, 'POST')
self.assertEquals(400, resp.status)
+ # clone a template with name parameter
+ old_temp = t['name']
+ t['os_distro'] = 'Linux.ISO'
+ t['os_version'] = '1.1'
+ t['graphics'] = {'type': 'vnc', 'listen': '0.0.0.0'}
+ t['name'] = "clone-template"
+ req = json.dumps(t)
+ resp = self.request('/templates/%s/clone' % old_temp, req, 'POST')
+ self.assertEquals(303, resp.status)
+
+ # Verify the clone template
+ res = json.loads(self.request('/templates/%s' % t['name']).read())
+ verify_template(t, res)
+ # Delete the template
+ resp = self.request('/templates/%s' % t['name'], '{}', 'DELETE')
+ self.assertEquals(204, resp.status)
+
+ # clone a template without name parameter
+ del t['name']
+ req = json.dumps(t)
+ resp = self.request('/templates/%s/clone' % old_temp, req, 'POST')
+ self.assertEquals(303, resp.status)
+
+ # Verify the clone template
+ res = json.loads(self.request('/templates/%s-clone1' %
+ old_temp).read())
+ t['name'] = res['name']
+ verify_template(t, res)
+ # Delete the template
+ resp = self.request('/templates/%s' % t['name'], '{}', 'DELETE')
+ self.assertEquals(204, resp.status)
+
+ t['name'] = old_temp
+
# Update the template
t['os_distro'] = 'Linux.ISO'
t['os_version'] = '1.1'
--
1.8.4.2
More information about the Kimchi-devel
mailing list