<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>Reviewed-by: Bianca Carvalho <a class="moz-txt-link-rfc2396E"
href="mailto:bianca@linux.vnet.ibm.com"><bianca@linux.vnet.ibm.com></a></p>
<br>
<div class="moz-cite-prefix">Em 8/31/16 8:13 PM, Ramon Medeiros
escreveu:<br>
</div>
<blockquote
cite="mid:1472685219-7246-3-git-send-email-ramonn@linux.vnet.ibm.com"
type="cite">
<pre wrap="">Signed-off-by: Ramon Medeiros <a class="moz-txt-link-rfc2396E" href="mailto:ramonn@linux.vnet.ibm.com"><ramonn@linux.vnet.ibm.com></a>
---
tests/test_model.py | 18 +++++++-----------
tests/test_rest.py | 10 ++++++++++
2 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/tests/test_model.py b/tests/test_model.py
index d9ffd5e..05f046c 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -325,25 +325,21 @@ class ModelTests(unittest.TestCase):
'source_media': {'type': 'disk', 'path': UBUNTU_ISO}}
inst.templates_create(params)
with RollbackContext() as rollback:
- params = {'name': 'kimchi-vnc',
+ params = {'name': 'kimchi-graphics',
'template': '/plugins/kimchi/templates/test'}
task1 = inst.vms_create(params)
inst.task_wait(task1['id'])
- rollback.prependDefer(inst.vm_delete, 'kimchi-vnc')
+ rollback.prependDefer(inst.vm_delete, 'kimchi-graphics')
- info = inst.vm_lookup('kimchi-vnc')
+ info = inst.vm_lookup('kimchi-graphics')
self.assertEquals('vnc', info['graphics']['type'])
self.assertEquals('127.0.0.1', info['graphics']['listen'])
- graphics = {'type': 'spice', 'listen': '127.0.0.1'}
- params = {'name': 'kimchi-spice',
- 'template': '/plugins/kimchi/templates/test',
- 'graphics': graphics}
- task2 = inst.vms_create(params)
- inst.task_wait(task2['id'])
- rollback.prependDefer(inst.vm_delete, 'kimchi-spice')
+ graphics = {'type': 'spice'}
+ params = {'graphics': graphics}
+ inst.vm_update('kimchi-graphics', params)
- info = inst.vm_lookup('kimchi-spice')
+ info = inst.vm_lookup('kimchi-graphics')
self.assertEquals('spice', info['graphics']['type'])
self.assertEquals('127.0.0.1', info['graphics']['listen'])
diff --git a/tests/test_rest.py b/tests/test_rest.py
index 90a808a..76f0b9c 100644
--- a/tests/test_rest.py
+++ b/tests/test_rest.py
@@ -301,6 +301,16 @@ class RestTests(unittest.TestCase):
resp = self.request('/plugins/kimchi/vms/∨м-црdαtеd', req, 'PUT')
self.assertEquals(400, resp.status)
+ # change vm graphics type
+ req = json.dumps({"graphics": {"type":"spice"}})
+ resp = self.request('/plugins/kimchi/vms/∨м-црdαtеd', req, 'PUT')
+ self.assertEquals(json.loads(resp.read())["graphics"]["type"], "spice")
+
+ # try to add a invalid type
+ req = json.dumps({"graphics": {"type":"test"}})
+ resp = self.request('/plugins/kimchi/vms/∨м-црdαtеd', req, 'PUT')
+ self.assertEquals(400, resp.status)
+
def test_vm_lifecycle(self):
# Create a Template
req = json.dumps({'name': 'test',
</pre>
</blockquote>
<br>
</body>
</html>