summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorSalvatore Orlando <salvatore.orlando@eu.citrix.com>2011-03-28 13:11:45 +0100
committerSalvatore Orlando <salvatore.orlando@eu.citrix.com>2011-03-28 13:11:45 +0100
commit381354babab58688458b2a6cdc463eb0a0fee461 (patch)
tree53b973c7fd199b0dc38fd9cea4e215c46e181977 /nova/tests
parent6e0fe0d799ec5b5c2279750b8fba1bb1527ede3c (diff)
addressed reviewers' concerns
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/test_xenapi.py35
-rw-r--r--nova/tests/xenapi/stubs.py6
2 files changed, 22 insertions, 19 deletions
diff --git a/nova/tests/test_xenapi.py b/nova/tests/test_xenapi.py
index 1c5a81f0d..feaced8ac 100644
--- a/nova/tests/test_xenapi.py
+++ b/nova/tests/test_xenapi.py
@@ -343,8 +343,10 @@ class XenAPIVMTestCase(test.TestCase):
1, 2, 3, "m1.xlarge")
def test_spawn_fail_cleanup_1(self):
- """Simulates an error while downloading image
- Verifies VDI create are properly cleaned up"""
+ """
+ Simulates an error while downloading image
+ Verifies VDI create are properly cleaned up.
+ """
FLAGS.xenapi_image_service = 'glance'
stubs.stubout_fetch_image_glance_disk(self.stubs)
self.assertRaises(xenapi_fake.Failure,
@@ -353,8 +355,10 @@ class XenAPIVMTestCase(test.TestCase):
self._check_no_unbound_vdi()
def test_spawn_fail_cleanup_2(self):
- """Simulates an error while creating VM record.
- Verifies VDI create are properly cleaned up"""
+ """
+ Simulates an error while creating VM record. It
+ verifies that VDI created are properly cleaned up.
+ """
FLAGS.xenapi_image_service = 'glance'
stubs.stubout_create_vm(self.stubs)
self.assertRaises(xenapi_fake.Failure,
@@ -423,18 +427,17 @@ class XenAPIVMTestCase(test.TestCase):
self.stubs.UnsetAll()
def _create_instance(self):
- """Creates and spawns a test instance"""
- values = {
- 'name': 1,
- 'id': 1,
- 'project_id': self.project.id,
- 'user_id': self.user.id,
- 'image_id': 1,
- 'kernel_id': 2,
- 'ramdisk_id': 3,
- 'instance_type': 'm1.large',
- 'mac_address': 'aa:bb:cc:dd:ee:ff',
- 'os_type': 'linux'}
+ """Creates and spawns a test instance."""
+ values = {'name': 1,
+ 'id': 1,
+ 'project_id': self.project.id,
+ 'user_id': self.user.id,
+ 'image_id': 1,
+ 'kernel_id': 2,
+ 'ramdisk_id': 3,
+ 'instance_type': 'm1.large',
+ 'mac_address': 'aa:bb:cc:dd:ee:ff',
+ 'os_type': 'linux'}
instance = db.instance_create(values)
self.conn.spawn(instance)
return instance
diff --git a/nova/tests/xenapi/stubs.py b/nova/tests/xenapi/stubs.py
index 709a8b6ff..b745205f5 100644
--- a/nova/tests/xenapi/stubs.py
+++ b/nova/tests/xenapi/stubs.py
@@ -138,14 +138,14 @@ def stubout_is_vdi_pv(stubs):
def stubout_lookup_image(stubs):
- """Simulates a failure in lookup image"""
+ """Simulates a failure in lookup image."""
def f(_1, _2, _3, _4):
raise Exception("Test Exception raised by fake lookup_image")
stubs.Set(vm_utils, 'lookup_image', f)
def stubout_fetch_image_glance_disk(stubs):
- """Simulates a failure in fetch image_glance_disk"""
+ """Simulates a failure in fetch image_glance_disk."""
@classmethod
def f(cls, *args):
@@ -155,7 +155,7 @@ def stubout_fetch_image_glance_disk(stubs):
def stubout_create_vm(stubs):
- """Simulates a failure in create_vm"""
+ """Simulates a failure in create_vm."""
@classmethod
def f(cls, *args):