summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-09-20 18:19:59 +0000
committerGerrit Code Review <review@openstack.org>2012-09-20 18:19:59 +0000
commit7cdd6c3fb4aeecb4a0441385576206bb17cdecfe (patch)
tree39a956a6f631fdee453cf80ec5442f2c6d7e5266 /nova
parent5b3a3a71972a406fd418396a808405ee56708d85 (diff)
parent2d473adb5a031b19bc82085e7362d77b63cec7fc (diff)
downloadnova-7cdd6c3fb4aeecb4a0441385576206bb17cdecfe.tar.gz
nova-7cdd6c3fb4aeecb4a0441385576206bb17cdecfe.tar.xz
nova-7cdd6c3fb4aeecb4a0441385576206bb17cdecfe.zip
Merge "Fix solidfire unit tests"
Diffstat (limited to 'nova')
-rw-r--r--nova/tests/test_solidfire.py23
1 files changed, 12 insertions, 11 deletions
diff --git a/nova/tests/test_solidfire.py b/nova/tests/test_solidfire.py
index 73018031a..475281d2b 100644
--- a/nova/tests/test_solidfire.py
+++ b/nova/tests/test_solidfire.py
@@ -84,6 +84,13 @@ class SolidFireVolumeTestCase(test.TestCase):
else:
LOG.error('Crap, unimplemented API call in Fake:%s' % method)
+ def fake_issue_api_request_no_volume(obj, method, params):
+ if method is 'ListVolumesForAccount':
+ LOG.info('Called Fake ListVolumesForAccount...')
+ return {'result': {'volumes': []}}
+ else:
+ return obj.fake_issue_api_request(method, params)
+
def fake_issue_api_request_fails(obj, method, params):
return {'error': {'code': 000,
'name': 'DummyError',
@@ -126,11 +133,8 @@ class SolidFireVolumeTestCase(test.TestCase):
'size': 1,
'id': 'a720b3c0-d1f0-11e1-9b23-0800200c9a66'}
sfv = SolidFire()
- try:
- sfv.create_volume(testvol)
- self.fail("Should have thrown Error")
- except Exception:
- pass
+ self.assertRaises(exception.SolidFireAPIDataException,
+ sfv.create_volume, testvol)
def test_create_sfaccount(self):
sfv = SolidFire()
@@ -172,17 +176,14 @@ class SolidFireVolumeTestCase(test.TestCase):
def test_delete_volume_fails_no_volume(self):
self.stubs.Set(SolidFire, '_issue_api_request',
- self.fake_issue_api_request)
+ self.fake_issue_api_request_no_volume)
testvol = {'project_id': 'testprjid',
'name': 'no-name',
'size': 1,
'id': 'a720b3c0-d1f0-11e1-9b23-0800200c9a66'}
sfv = SolidFire()
- try:
- model_update = sfv.delete_volume(testvol)
- self.fail("Should have thrown Error")
- except Exception:
- pass
+ self.assertRaises(exception.VolumeNotFound,
+ sfv.delete_volume, testvol)
def test_delete_volume_fails_account_lookup(self):
self.stubs.Set(SolidFire, '_issue_api_request',