Hi Paulo,
The other patches uses the API to do tests. In that case, we need to use
the absolute API.
But when storing APIs internally to an object JSON, we should use
relative API, so UI can properly
handle the case in which user configures the proxy to use a different
prefix than /, for example, /wok
Does that make sense?
Regards,
Aline Manera
On 22/10/2015 08:46, Paulo Ricardo Paz Vital wrote:
You used a slash ("/") before any path or URI that code is
working on
in all other patches, but only in this one you removed all slashes from
the beginning of the paths. Why?
Paulo Vital.
On Wed, 2015-10-21 at 21:40 -0200, Aline Manera wrote:
> Also update the test cases according to lastest changes on Wok and
> Kimchi as a plugin.
>
> Signed-off-by: Aline Manera <alinefm(a)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'})