This tests cover issues #682/#684/#685
Signed-off-by: Ramon Medeiros <ramonn(a)linux.vnet.ibm.com>
---
tests/test_rest.py | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/tests/test_rest.py b/tests/test_rest.py
index d4715a0..7e726b0 100644
--- a/tests/test_rest.py
+++ b/tests/test_rest.py
@@ -275,11 +275,27 @@ 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)
+
+ # verify if reset command returns correct status
+ resp = self.request('/vms/test-vm/reset', '{}', '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 start 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