From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
update test_rest.py
do not update test_model.py.
for commit c4c093e does not allow to delete pool kimchi-test-pool
as it is associated with some templates
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
---
tests/test_rest.py | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/tests/test_rest.py b/tests/test_rest.py
index 54530f3..e5f50ae 100644
--- a/tests/test_rest.py
+++ b/tests/test_rest.py
@@ -1087,8 +1087,15 @@ class RestTests(unittest.TestCase):
resp = request(host, port, '/networks', req, 'POST')
self.assertEquals(201, resp.status)
+ req = json.dumps({'name': 'test-storagepool',
+ 'path': '/tmp/kimchi-images',
+ 'type': 'dir'})
+ resp = request(host, port, '/storagepools', req, 'POST')
+ self.assertEquals(201, resp.status)
+
t = {'name': 'test', 'memory': 1024, 'cpus': 1,
- 'networks': ['test-network'], 'cdrom': iso}
+ 'networks': ['test-network'], 'cdrom': iso,
+ 'storagepool': '/storagepools/test-storagepool'}
req = json.dumps(t)
resp = self.request('/templates', req, 'POST')
@@ -1099,10 +1106,16 @@ class RestTests(unittest.TestCase):
resp = request(host, port, '/networks/test-network', '{}',
'DELETE')
self.assertEquals(204, resp.status)
+ # Delete the storagepool
+ resp = request(host, port, '/storagepools/test-storagepool',
+ '{}', 'DELETE')
+ self.assertEquals(204, resp.status)
+
# Verify the template
res = json.loads(self.request('/templates/test').read())
self.assertEquals(res['invalid']['cdrom'], [iso])
self.assertEquals(res['invalid']['networks'],
['test-network'])
+ self.assertEquals(res['invalid']['storagepools'],
['test-storagepool'])
# Delete the template
resp = request(host, port, '/templates/test', '{}',
'DELETE')
--
1.8.4.2