[Kimchi-devel] [PATCH 2/2] Add unity tests for start/shutdown/poweroff response commands

Ramon Medeiros ramonn at linux.vnet.ibm.com
Mon Aug 24 18:43:04 UTC 2015


This tests cover issues #682/#684/#685

Signed-off-by: Ramon Medeiros <ramonn at linux.vnet.ibm.com>
---
 tests/test_rest.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tests/test_rest.py b/tests/test_rest.py
index d4715a0..48beae0 100644
--- a/tests/test_rest.py
+++ b/tests/test_rest.py
@@ -275,11 +275,23 @@ class RestTests(unittest.TestCase):
         self.assertEquals(1 << 30, vol['capacity'])
         self.assertEquals(['test-vm'], vol['used_by'])
 
+        # verify if poweroff command returns correct status
+        resp = self.request('/vms/test-vm/poweroff', '{}', 'POST')
+        self.assertEquals(400, resp.status)
+
+        # verify if shutdown command returns correct status
+        resp = self.request('/vms/test-vm/shutdown', '{}', 'POST')
+        self.assertEquals(400, resp.status)
+
         # Start the VM
         resp = self.request('/vms/test-vm/start', '{}', 'POST')
         vm = json.loads(self.request('/vms/test-vm').read())
         self.assertEquals('running', vm['state'])
 
+        # verify if poweroff command returns correct status
+        resp = self.request('/vms/test-vm/start', '{}', 'POST')
+        self.assertEquals(400, resp.status)
+
         # Test screenshot
         resp = self.request(vm['screenshot'], method='HEAD')
         self.assertEquals(200, resp.status)
-- 
2.1.0




More information about the Kimchi-devel mailing list