summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-04-11 12:14:16 +0000
committerGerrit Code Review <review@openstack.org>2013-04-11 12:14:16 +0000
commit284cc009175f0d87683dc6a98ee997e8476ef87c (patch)
tree3abad2da4a9157f46f04eed5c2b51427dabd8c45 /nova/tests
parent6b2af9c084754a1e678f741bfc6b97e13f1cf8a5 (diff)
parent588b5651dc515d642b110f61c41d78860206841c (diff)
Merge "Remove "undefined name" pyflake errors"
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/test_db_api.py2
-rw-r--r--nova/tests/test_powervm.py43
2 files changed, 27 insertions, 18 deletions
diff --git a/nova/tests/test_db_api.py b/nova/tests/test_db_api.py
index ad295e9a7..93685c359 100644
--- a/nova/tests/test_db_api.py
+++ b/nova/tests/test_db_api.py
@@ -2745,7 +2745,7 @@ class VirtualInterfaceTestCase(test.TestCase, ModelsObjectComparatorMixin):
# NOTE(boris-42): Due to the bug 1156227 this won't work. In havana-1
# it will be fixed.
self.assertRaises(exception.VirtualInterfaceCreateException,
- self._create_virt_interface, {uuid: vif['uuid']})
+ self._create_virt_interface, {"uuid": vif['uuid']})
def test_virtual_interface_get(self):
vifs = [self._create_virt_interface({'address':'a'}),
diff --git a/nova/tests/test_powervm.py b/nova/tests/test_powervm.py
index 572c0f946..a8278f085 100644
--- a/nova/tests/test_powervm.py
+++ b/nova/tests/test_powervm.py
@@ -404,23 +404,6 @@ class PowerVMDriverTestCase(test.TestCase):
context, instance,
dest, instance_type, network_info, block_device_info)
- def test_set_lpar_mac_base_value_command(self):
- inst_name = 'some_instance'
- mac = 'FA:98:64:2B:29:39'
- exp_mac_str = mac[:-2].replace(':', '').lower()
-
- def fake_run_vios_command(cmd, *args, **kwargs):
- exp_cmd = ('chsyscfg -r lpar -i "name=%(inst_name)s, ',
- 'virtual_eth_mac_base_value=%(exp_mac_str)s"' %
- locals())
- assertEqual(exp_cmd, cmd)
-
- self.stubs.Set(self.powervm_connection._powervm._operator,
- 'run_vios_command', fake_run_vios_command)
-
- fake_op = self.powervm_connection._powervm
- fake_op._operator.set_lpar_mac_base_value(inst_name, mac)
-
def test_migrate_build_scp_command(self):
lv_name = 'logical-vol-name'
src_host = 'compute_host_1'
@@ -488,3 +471,29 @@ class PowerVMDriverTestCase(test.TestCase):
self.assertEquals(host_stats['supported_instances'][0][0], "ppc64")
self.assertEquals(host_stats['supported_instances'][0][1], "powervm")
self.assertEquals(host_stats['supported_instances'][0][2], "hvm")
+
+
+class PowerVMDriverLparTestCase(test.TestCase):
+ """Unit tests for PowerVM connection calls."""
+
+ def setUp(self):
+ super(PowerVMDriverLparTestCase, self).setUp()
+ self.stubs.Set(operator.PowerVMOperator, '_update_host_stats',
+ lambda self: None)
+ self.powervm_connection = powervm_driver.PowerVMDriver(None)
+
+ def test_set_lpar_mac_base_value_command(self):
+ inst_name = 'some_instance'
+ mac = 'FA:98:64:2B:29:39'
+ exp_mac_str = mac[:-2].replace(':', '')
+
+ exp_cmd = ('chsyscfg -r lpar -i "name=%(inst_name)s, '
+ 'virtual_eth_mac_base_value=%(exp_mac_str)s"') % locals()
+
+ fake_op = self.powervm_connection._powervm
+ self.mox.StubOutWithMock(fake_op._operator, 'run_vios_command')
+ fake_op._operator.run_vios_command(exp_cmd)
+
+ self.mox.ReplayAll()
+
+ fake_op._operator.set_lpar_mac_base_value(inst_name, mac)