From: Paulo Vital <pvital(a)linux.vnet.ibm.com>
Update Kimchi tests to use the new URL of Tasks from Wok structure.
Signed-off-by: Paulo Vital <pvital(a)linux.vnet.ibm.com>
---
plugins/kimchi/tests/test_host.py | 4 ++--
plugins/kimchi/tests/test_mock_storagepool.py | 2 +-
plugins/kimchi/tests/test_model_storagevolume.py | 8 ++++----
plugins/kimchi/tests/test_rest.py | 22 +++++++++++-----------
plugins/kimchi/tests/test_server.py | 8 ++++----
5 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/plugins/kimchi/tests/test_host.py b/plugins/kimchi/tests/test_host.py
index 9bc9302..6cd0833 100644
--- a/plugins/kimchi/tests/test_host.py
+++ b/plugins/kimchi/tests/test_host.py
@@ -128,12 +128,12 @@ class HostTests(unittest.TestCase):
task_params = [u'id', u'message', u'status',
u'target_uri']
self.assertEquals(sorted(task_params), sorted(task.keys()))
- resp = self.request('/plugins/kimchi/tasks/' + task[u'id'],
None,
+ resp = self.request('/tasks/' + task[u'id'], None,
'GET')
task_info = json.loads(resp.read())
self.assertEquals(task_info['status'], 'running')
wait_task(_task_lookup, task_info['id'])
- resp = self.request('/plugins/kimchi/tasks/' + task[u'id'],
None,
+ resp = self.request('/tasks/' + task[u'id'], None,
'GET')
task_info = json.loads(resp.read())
self.assertEquals(task_info['status'], 'finished')
diff --git a/plugins/kimchi/tests/test_mock_storagepool.py
b/plugins/kimchi/tests/test_mock_storagepool.py
index ea9843b..5cf5b3e 100644
--- a/plugins/kimchi/tests/test_mock_storagepool.py
+++ b/plugins/kimchi/tests/test_mock_storagepool.py
@@ -61,7 +61,7 @@ class MockStoragepoolTests(unittest.TestCase):
def _task_lookup(self, taskid):
return json.loads(
- self.request('/plugins/kimchi/tasks/%s' % taskid).read()
+ self.request('/tasks/%s' % taskid).read()
)
def test_storagepool(self):
diff --git a/plugins/kimchi/tests/test_model_storagevolume.py
b/plugins/kimchi/tests/test_model_storagevolume.py
index 8a717d3..46c07bd 100644
--- a/plugins/kimchi/tests/test_model_storagevolume.py
+++ b/plugins/kimchi/tests/test_model_storagevolume.py
@@ -64,7 +64,7 @@ def tearDownModule():
def _do_volume_test(self, model, host, ssl_port, pool_name):
def _task_lookup(taskid):
return json.loads(
- self.request('/plugins/kimchi/tasks/%s' % taskid).read()
+ self.request('/tasks/%s' % taskid).read()
)
uri = '/plugins/kimchi/storagepools/%s/storagevolumes' \
@@ -91,7 +91,7 @@ def _do_volume_test(self, model, host, ssl_port, pool_name):
task_id = json.loads(resp.read())['id']
wait_task(_task_lookup, task_id)
status = json.loads(
- self.request('/plugins/kimchi/tasks/%s' % task_id).read()
+ self.request('/tasks/%s' % task_id).read()
)
self.assertEquals('finished', status['status'])
vol_info = json.loads(self.request(vol_uri).read())
@@ -137,7 +137,7 @@ def _do_volume_test(self, model, host, ssl_port, pool_name):
cloned_vol_name)
wait_task(_task_lookup, task['id'])
task = json.loads(
- self.request('/plugins/kimchi/tasks/%s' %
task['id']).read()
+ self.request('/tasks/%s' % task['id']).read()
)
self.assertEquals('finished', task['status'])
resp = self.request(uri + '/' +
cloned_vol_name.encode('utf-8'))
@@ -177,7 +177,7 @@ def _do_volume_test(self, model, host, ssl_port, pool_name):
self.assertEquals(202, resp.status)
task_id = json.loads(resp.read())['id']
wait_task(_task_lookup, task_id)
- status = json.loads(self.request('/plugins/kimchi/tasks/%s' %
+ status = json.loads(self.request('/tasks/%s' %
task_id).read())
self.assertEquals('ready for upload', status['message'])
diff --git a/plugins/kimchi/tests/test_rest.py b/plugins/kimchi/tests/test_rest.py
index a420062..243074e 100644
--- a/plugins/kimchi/tests/test_rest.py
+++ b/plugins/kimchi/tests/test_rest.py
@@ -317,7 +317,7 @@ class RestTests(unittest.TestCase):
task = json.loads(resp.read())
wait_task(self._task_lookup, task['id'])
task = json.loads(
- self.request('/plugins/kimchi/tasks/%s' % task['id'],
'{}').read()
+ self.request('/tasks/%s' % task['id'], '{}').read()
)
self.assertEquals('finished', task['status'])
clone_vm_name = task['target_uri'].split('/')[-2]
@@ -348,7 +348,7 @@ class RestTests(unittest.TestCase):
task = json.loads(resp.read())
wait_task(self._task_lookup, task['id'])
task = json.loads(
- self.request('/plugins/kimchi/tasks/%s' % task['id']).read()
+ self.request('/tasks/%s' % task['id']).read()
)
self.assertEquals('finished', task['status'])
@@ -386,7 +386,7 @@ class RestTests(unittest.TestCase):
task = json.loads(resp.read())
snap_name = task['target_uri'].split('/')[-1]
wait_task(self._task_lookup, task['id'])
- resp = self.request('/plugins/kimchi/tasks/%s' % task['id'],
'{}',
+ resp = self.request('/tasks/%s' % task['id'], '{}',
'GET')
task = json.loads(resp.read())
self.assertEquals('finished', task['status'])
@@ -1132,37 +1132,37 @@ class RestTests(unittest.TestCase):
def _task_lookup(self, taskid):
return json.loads(
- self.request('/plugins/kimchi/tasks/%s' % taskid).read()
+ self.request('/tasks/%s' % taskid).read()
)
def test_tasks(self):
- id1 = add_task('/plugins/kimchi/tasks/1', self._async_op,
+ id1 = add_task('/tasks/1', self._async_op,
model.objstore)
- id2 = add_task('/plugins/kimchi/tasks/2', self._except_op,
+ id2 = add_task('/tasks/2', self._except_op,
model.objstore)
- id3 = add_task('/plugins/kimchi/tasks/3', self._intermid_op,
+ id3 = add_task('/tasks/3', self._intermid_op,
model.objstore)
target_uri = urllib2.quote('^/tasks/*', safe="")
filter_data = 'status=running&target_uri=%s' % target_uri
tasks = json.loads(
- self.request('/plugins/kimchi/tasks?%s' % filter_data).read()
+ self.request('/tasks?%s' % filter_data).read()
)
self.assertEquals(3, len(tasks))
- tasks = json.loads(self.request('/plugins/kimchi/tasks').read())
+ tasks = json.loads(self.request('/tasks').read())
tasks_ids = [int(t['id']) for t in tasks]
self.assertEquals(set([id1, id2, id3]) - set(tasks_ids), set([]))
wait_task(self._task_lookup, id2)
foo2 = json.loads(
- self.request('/plugins/kimchi/tasks/%s' % id2).read()
+ self.request('/tasks/%s' % id2).read()
)
keys = ['id', 'status', 'message', 'target_uri']
self.assertEquals(sorted(keys), sorted(foo2.keys()))
self.assertEquals('failed', foo2['status'])
wait_task(self._task_lookup, id3)
foo3 = json.loads(
- self.request('/plugins/kimchi/tasks/%s' % id3).read()
+ self.request('/tasks/%s' % id3).read()
)
self.assertEquals('in progress', foo3['message'])
self.assertEquals('running', foo3['status'])
diff --git a/plugins/kimchi/tests/test_server.py b/plugins/kimchi/tests/test_server.py
index d7f1af0..d5ef565 100644
--- a/plugins/kimchi/tests/test_server.py
+++ b/plugins/kimchi/tests/test_server.py
@@ -194,7 +194,7 @@ class ServerTests(unittest.TestCase):
hdrs = {'AUTHORIZATION': ''}
uris = ['/plugins/kimchi/vms',
'/plugins/kimchi/vms/doesnotexist',
- '/plugins/kimchi/tasks']
+ '/tasks']
for uri in uris:
resp = self.request(uri, None, 'GET', hdrs)
@@ -228,7 +228,7 @@ class ServerTests(unittest.TestCase):
'Accept': 'application/json'}
# Test we are logged out
- resp = self.request('/plugins/kimchi/tasks', None, 'GET', hdrs)
+ resp = self.request('/tasks', None, 'GET', hdrs)
self.assertEquals(401, resp.status)
# Execute a login call
@@ -248,7 +248,7 @@ class ServerTests(unittest.TestCase):
hdrs['Cookie'] = cookie
# Test we are logged in with the cookie
- resp = self.request('/plugins/kimchi/tasks', None, 'GET', hdrs)
+ resp = self.request('/tasks', None, 'GET', hdrs)
self.assertEquals(200, resp.status)
# Execute a logout call
@@ -257,7 +257,7 @@ class ServerTests(unittest.TestCase):
del hdrs['Cookie']
# Test we are logged out
- resp = self.request('/plugins/kimchi/tasks', None, 'GET', hdrs)
+ resp = self.request('/tasks', None, 'GET', hdrs)
self.assertEquals(401, resp.status)
def test_get_param(self):
--
2.4.3