Signed-off-by: Jose Ricardo Ziviani <joserz(a)linux.vnet.ibm.com>
---
tests/test_model.py | 13 +++++++++----
tests/test_rest.py | 12 +++++++-----
2 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/tests/test_model.py b/tests/test_model.py
index 88c020e..7a7b97d 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -368,12 +368,17 @@ class ModelTests(unittest.TestCase):
self.assertEquals("test-network", iface['network'])
# update vm interface
- iface_args = {"network": "default",
- "model": "e1000"}
+ newMacAddr = '54:50:e3:44:8a:af'
+ iface_args = {"mac": newMacAddr}
inst.vmiface_update(vm_name, mac, iface_args)
+ iface = inst.vmiface_lookup(vm_name, newMacAddr)
+ self.assertEquals(newMacAddr, iface['mac'])
+
+ # undo mac address change
+ iface_args = {"mac": mac}
+ inst.vmiface_update(vm_name, newMacAddr, iface_args)
iface = inst.vmiface_lookup(vm_name, mac)
- self.assertEquals("default", iface['network'])
- self.assertEquals("e1000", iface["model"])
+ self.assertEquals(mac, iface['mac'])
@unittest.skipUnless(utils.running_as_root(), 'Must be run as root')
def test_vm_disk(self):
diff --git a/tests/test_rest.py b/tests/test_rest.py
index 914b602..d917d8f 100644
--- a/tests/test_rest.py
+++ b/tests/test_rest.py
@@ -724,13 +724,15 @@ class RestTests(unittest.TestCase):
self.assertEquals('network', iface['type'])
# update vm interface
- req = json.dumps({"network": "default",
"model": "virtio"})
+ newMacAddr = '54:50:e3:44:8a:af'
+ req = json.dumps({"network": "default",
"model": "virtio",
+ "type": "network", "mac":
newMacAddr})
resp = self.request('/vms/test-vm/ifaces/%s' % iface['mac'],
req, 'PUT')
- self.assertEquals(200, resp.status)
- update_iface = json.loads(resp.read())
- self.assertEquals(u'virtio', update_iface['model'])
- self.assertEquals('default', update_iface['network'])
+ self.assertEquals(303, resp.status)
+ iface = json.loads(self.request('/vms/test-vm/ifaces/%s' %
+ newMacAddr).read())
+ self.assertEquals(newMacAddr, iface['mac'])
# detach network interface from vm
resp = self.request('/vms/test-vm/ifaces/%s' % iface['mac'],
--
1.9.1