Fixes the Hyper-V VolumeOpsTestCase base class

The VolumeOpsTestCase base class inherits incorrectly from
HyperVAPITestCase, with the unwanted side effect of executing all
base class tests as well.

This patch generalizes a common base class from HyperVAPITestCase
and fixes the inheritance issue.

Closes-Bug: #1280379

Change-Id: Ic81beb8397138c16c8d2d88a9c9d05d2b76e0e83
This commit is contained in:
Alessandro Pilotti 2014-02-14 19:22:35 +02:00
parent a1fe8dfd58
commit c1a64c94ef
1 changed files with 10 additions and 6 deletions

View File

@ -69,15 +69,15 @@ CONF = cfg.CONF
CONF.import_opt('vswitch_name', 'nova.virt.hyperv.vif', 'hyperv')
class HyperVAPITestCase(test.NoDBTestCase):
"""Unit tests for Hyper-V driver calls."""
class HyperVAPIBaseTestCase(test.NoDBTestCase):
"""Base unit tests class for Hyper-V driver calls."""
def __init__(self, test_case_name):
self._mox = mox.Mox()
super(HyperVAPITestCase, self).__init__(test_case_name)
super(HyperVAPIBaseTestCase, self).__init__(test_case_name)
def setUp(self):
super(HyperVAPITestCase, self).setUp()
super(HyperVAPIBaseTestCase, self).setUp()
self._user_id = 'fake'
self._project_id = 'fake'
@ -248,7 +248,11 @@ class HyperVAPITestCase(test.NoDBTestCase):
def tearDown(self):
self._mox.UnsetStubs()
super(HyperVAPITestCase, self).tearDown()
super(HyperVAPIBaseTestCase, self).tearDown()
class HyperVAPITestCase(HyperVAPIBaseTestCase):
"""Unit tests for Hyper-V driver calls."""
def test_get_available_resource(self):
cpu_info = {'Architecture': 'fake',
@ -1666,7 +1670,7 @@ class HyperVAPITestCase(test.NoDBTestCase):
self.assertEqual(fake_vm_id, connect_info['internal_access_path'])
class VolumeOpsTestCase(HyperVAPITestCase):
class VolumeOpsTestCase(HyperVAPIBaseTestCase):
"""Unit tests for VolumeOps class."""
def setUp(self):