[Kimchi-devel] [PATCH 2/6] Tests for new clone target_uri

Christy Perez christy at linux.vnet.ibm.com
Mon Apr 27 17:28:09 UTC 2015


Signed-off-by: Christy Perez <christy at linux.vnet.ibm.com>
---
 tests/test_model.py               | 4 ++--
 tests/test_model_storagevolume.py | 2 +-
 tests/test_rest.py                | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/test_model.py b/tests/test_model.py
index daddb97..16ec239 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -869,9 +869,9 @@ def test_vm_clone(self):
             # and make sure both of them complete successfully
             task1 = inst.vm_clone(name)
             task2 = inst.vm_clone(name)
-            clone1_name = task1['target_uri'].split('/')[-1]
+            clone1_name = task1['target_uri'].split('/')[-2]
             rollback.prependDefer(inst.vm_delete, clone1_name)
-            clone2_name = task2['target_uri'].split('/')[-1]
+            clone2_name = task2['target_uri'].split('/')[-2]
             rollback.prependDefer(inst.vm_delete, clone2_name)
             inst.task_wait(task1['id'])
             task1 = inst.task_lookup(task1['id'])
diff --git a/tests/test_model_storagevolume.py b/tests/test_model_storagevolume.py
index a3c3ce3..11fd90d 100644
--- a/tests/test_model_storagevolume.py
+++ b/tests/test_model_storagevolume.py
@@ -124,7 +124,7 @@ def _task_lookup(taskid):
             resp = self.request(vol_uri + '/clone', '{}', 'POST')
             self.assertEquals(202, resp.status)
             task = json.loads(resp.read())
-            cloned_vol_name = task['target_uri'].split('/')[-1]
+            cloned_vol_name = task['target_uri'].split('/')[-2]
             rollback.prependDefer(model.storagevolume_delete, pool_name,
                                   cloned_vol_name)
             wait_task(_task_lookup, task['id'])
diff --git a/tests/test_rest.py b/tests/test_rest.py
index 5bde044..6b37b9b 100644
--- a/tests/test_rest.py
+++ b/tests/test_rest.py
@@ -305,7 +305,7 @@ def test_vm_lifecycle(self):
         wait_task(self._task_lookup, task['id'])
         task = json.loads(self.request('/tasks/%s' % task['id'], '{}').read())
         self.assertEquals('finished', task['status'])
-        clone_vm_name = task['target_uri'].split('/')[-1]
+        clone_vm_name = task['target_uri'].split('/')[-2]
         self.assertTrue(re.match(u'test-vm-clone-\d+', clone_vm_name))
 
         resp = self.request('/vms/test-vm', '{}')
-- 
2.1.0




More information about the Kimchi-devel mailing list