Please, add new test cases to validate the API you've just created.
GET /vms will return the boot order
PUT /vms/*name* {bootorder: [...]} will change the boot order and verify
it was really changed
etc...
On 07/13/2016 03:18 PM, Ramon Medeiros wrote:
Also, update new entry on a test at test_model
Signed-off-by: Ramon Medeiros <ramonn(a)linux.vnet.ibm.com>
---
tests/test_mockmodel.py | 2 +-
tests/test_model.py | 15 ++++++++++++++-
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/tests/test_mockmodel.py b/tests/test_mockmodel.py
index 45358fe..0db1ff2 100644
--- a/tests/test_mockmodel.py
+++ b/tests/test_mockmodel.py
@@ -163,7 +163,7 @@ class MockModelTests(unittest.TestCase):
keys = set(('name', 'state', 'stats', 'uuid',
'memory', 'cpu_info',
'screenshot', 'icon', 'graphics',
'users', 'groups',
- 'access', 'persistent'))
+ 'access', 'persistent', 'bootorder'))
stats_keys = set(('cpu_utilization', 'mem_utilization',
'net_throughput', 'net_throughput_peak',
diff --git a/tests/test_model.py b/tests/test_model.py
index 9a6a1aa..09ef995 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -118,7 +118,7 @@ class ModelTests(unittest.TestCase):
keys = set(('name', 'state', 'stats', 'uuid',
'memory', 'cpu_info',
'screenshot', 'icon', 'graphics',
'users', 'groups',
- 'access', 'persistent'))
+ 'access', 'persistent', 'bootorder'))
stats_keys = set(('cpu_utilization', 'mem_utilization',
'net_throughput', 'net_throughput_peak',
@@ -1124,6 +1124,19 @@ class ModelTests(unittest.TestCase):
self.assertEquals([], inst.vm_lookup(u'пeω-∨м')['users'])
self.assertEquals([], inst.vm_lookup(u'пeω-∨м')['groups'])
+ # change bootorder
+ b_order = ["hd", "network", "cdrom"]
+ inst.vm_update(u'пeω-∨м', {"bootorder": b_order})
+ self.assertEquals(b_order,
inst.vm_lookup(u'пeω-∨м')['bootorder'])
+
+ # try to add empty list
+ self.assertRaises(OperationFailed, inst.vm_update, u'пeω-∨м',
+ {"bootorder": [""]})
+
+ # try to pass invalid parameter
+ self.assertRaises(OperationFailed, inst.vm_update, u'пeω-∨м',
+ {"bootorder": ["bla"]})
+
def test_get_interfaces(self):
inst = model.Model('test:///default',
objstore_loc=self.tmp_store)