[Kimchi-devel] [PATCH 2/6] Make sure to use relative path when setting an icon to a guest
Aline Manera
alinefm at linux.vnet.ibm.com
Wed Oct 21 23:40:46 UTC 2015
Also update the test cases according to lastest changes on Wok and
Kimchi as a plugin.
Signed-off-by: Aline Manera <alinefm at linux.vnet.ibm.com>
---
src/wok/plugins/kimchi/API.json | 4 ++--
src/wok/plugins/kimchi/tests/test_rest.py | 4 ++--
src/wok/plugins/kimchi/tests/test_template.py | 5 +++--
3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/wok/plugins/kimchi/API.json b/src/wok/plugins/kimchi/API.json
index fc1d2dd..b718dcd 100644
--- a/src/wok/plugins/kimchi/API.json
+++ b/src/wok/plugins/kimchi/API.json
@@ -428,7 +428,7 @@
"icon": {
"description": "The template icon path",
"type": "string",
- "pattern": "^/plugins/kimchi/images/",
+ "pattern": "^plugins/kimchi/images/",
"error": "KCHTMPL0009E"
},
"os_distro": {
@@ -600,7 +600,7 @@
"icon": {
"description": "The template icon path",
"type": "string",
- "pattern": "^/plugins/kimchi/images/",
+ "pattern": "^plugins/kimchi/images/",
"error": "KCHTMPL0009E"
},
"os_distro": {
diff --git a/src/wok/plugins/kimchi/tests/test_rest.py b/src/wok/plugins/kimchi/tests/test_rest.py
index e1a2f54..b7fa2e1 100644
--- a/src/wok/plugins/kimchi/tests/test_rest.py
+++ b/src/wok/plugins/kimchi/tests/test_rest.py
@@ -259,7 +259,7 @@ class RestTests(unittest.TestCase):
def test_vm_lifecycle(self):
# Create a Template
req = json.dumps({'name': 'test', 'disks': [{'size': 1}],
- 'icon': 'images/icon-debian.png',
+ 'icon': 'plugins/kimchi/images/icon-debian.png',
'cdrom': fake_iso})
resp = self.request('/plugins/kimchi/templates', req, 'POST')
self.assertEquals(201, resp.status)
@@ -275,7 +275,7 @@ class RestTests(unittest.TestCase):
# Verify the VM
vm = json.loads(self.request('/plugins/kimchi/vms/test-vm').read())
self.assertEquals('shutoff', vm['state'])
- self.assertEquals('images/icon-debian.png', vm['icon'])
+ self.assertEquals('plugins/kimchi/images/icon-debian.png', vm['icon'])
# Verify the volume was created
vol_uri = '/plugins/kimchi/storagepools/default-pool/storagevolumes/' \
diff --git a/src/wok/plugins/kimchi/tests/test_template.py b/src/wok/plugins/kimchi/tests/test_template.py
index 6a1a663..c8f29f0 100644
--- a/src/wok/plugins/kimchi/tests/test_template.py
+++ b/src/wok/plugins/kimchi/tests/test_template.py
@@ -161,11 +161,12 @@ class TemplateTests(unittest.TestCase):
self.assertEquals(tmpl, update_tmpl)
# Update icon
- req = json.dumps({'icon': 'kimchi/images/icon-fedora.png'})
+ req = json.dumps({'icon': 'plugins/kimchi/images/icon-fedora.png'})
resp = self.request(new_tmpl_uri, req, 'PUT')
self.assertEquals(200, resp.status)
update_tmpl = json.loads(resp.read())
- self.assertEquals('kimchi/images/icon-fedora.png', update_tmpl['icon'])
+ self.assertEquals('plugins/kimchi/images/icon-fedora.png',
+ update_tmpl['icon'])
# Update os_distro and os_version
req = json.dumps({'os_distro': 'fedora', 'os_version': '21'})
--
2.1.0
More information about the Kimchi-devel
mailing list