Reviewed-By: Ramon Medeiros <ramonn(a)linux.vnet.ibm.com>
PS: Use cover-letter next time
On 02/09/2017 03:05 PM, Lucio Correia wrote:
Connect directly to cherrypy, without using nginx.
Use json instead of dictionary, since Cherrypy does not
understand a dict as JSON data. Since tests are now ran
without nginx proxy, those need to be fixed.
Signed-off-by: Lucio Correia <luciojhc(a)linux.vnet.ibm.com>
---
tests/test_model_storagevolume.py | 4 ++--
tests/test_rest.py | 16 ++++++++--------
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/tests/test_model_storagevolume.py b/tests/test_model_storagevolume.py
index a1f1db9..638751a 100644
--- a/tests/test_model_storagevolume.py
+++ b/tests/test_model_storagevolume.py
@@ -28,7 +28,7 @@ import unittest
from functools import partial
from tests.utils import fake_auth_header, HOST
-from tests.utils import patch_auth, PROXY_PORT, request
+from tests.utils import patch_auth, PORT, request
from tests.utils import rollback_wrapper, run_server, wait_task
from wok.config import paths
@@ -171,7 +171,7 @@ def _do_volume_test(self, model, pool_name):
self.assertEquals('ready for upload', status['message'])
# Upload volume content
- url = 'https://%s:%s' % (HOST, PROXY_PORT) + uri + '/' +
filename
+ url = 'http://%s:%s' % (HOST, PORT) + uri + '/' + filename
# Create a file with 5M to upload
# Max body size is set to 4M so the upload will fail with 413
diff --git a/tests/test_rest.py b/tests/test_rest.py
index 4c7ab5b..852e4bd 100644
--- a/tests/test_rest.py
+++ b/tests/test_rest.py
@@ -909,17 +909,17 @@ class RestTests(unittest.TestCase):
)
self.assertEquals(3, len(devs))
resp = self.request('/plugins/kimchi/storagepools/tmp/deactivate',
- {}, 'POST')
+ '{}', 'POST')
self.assertEquals(200, resp.status)
# cannot delete storagepool with volumes associate to guests
- resp = self.request('/plugins/kimchi/storagepools/tmp', {},
+ resp = self.request('/plugins/kimchi/storagepools/tmp',
'{}',
'DELETE')
self.assertEquals(400, resp.status)
# activate pool
resp = self.request('/plugins/kimchi/storagepools/tmp/activate',
- {}, 'POST')
+ '{}', 'POST')
self.assertEquals(200, resp.status)
# delete volumes
@@ -927,14 +927,14 @@ class RestTests(unittest.TestCase):
l = '/plugins/kimchi/vms/test-vm/storages/hdd'
else:
l = '/plugins/kimchi/vms/test-vm/storages/vdb'
- resp = self.request(l, {}, 'DELETE')
+ resp = self.request(l, '{}', 'DELETE')
self.assertEquals(204, resp.status)
# deactive and delete storage pool
resp = self.request('/plugins/kimchi/storagepools/tmp/deactivate',
- {}, 'POST')
+ '{}', 'POST')
self.assertEquals(200, resp.status)
- resp = self.request('/plugins/kimchi/storagepools/tmp', {},
+ resp = self.request('/plugins/kimchi/storagepools/tmp',
'{}',
'DELETE')
self.assertEquals(204, resp.status)
@@ -1151,7 +1151,7 @@ class RestTests(unittest.TestCase):
self.assertEquals(202, resp.status)
task = json.loads(resp.read())
wait_task(self._task_lookup, task['id'])
- resp = self.request('/plugins/kimchi/vms/test-vm', {}, 'GET')
+ resp = self.request('/plugins/kimchi/vms/test-vm', '{}',
'GET')
vm_info = json.loads(resp.read())
# Test template not changed after vm customise its pool
@@ -1246,7 +1246,7 @@ class RestTests(unittest.TestCase):
task = json.loads(self.request('/plugins/kimchi/vms',
req, 'POST').read())
wait_task(self._task_lookup, task['id'])
- resp = self.request('/plugins/kimchi/vms/test-vm-%i' % i, {},
+ resp = self.request('/plugins/kimchi/vms/test-vm-%i' % i,
'{}',
'GET')
self.assertEquals(resp.status, 200)
count = len(json.loads(self.request('/plugins/kimchi/vms').read()))