Move FakeFlavor class to fakes.py
Move the FakeFlavor class used in tests to the fakes.py file. Change-Id: I17ddc7a0e6e875109babda0a0077b3926df03e9d
This commit is contained in:
parent
fa2de4f913
commit
8e861fa243
|
@ -411,3 +411,17 @@ class FakeNeutronSubnet(dict):
|
|||
self[key] = value
|
||||
else:
|
||||
raise AttributeError(key)
|
||||
|
||||
|
||||
class FakeFlavor(object):
|
||||
def __init__(self, name, profile=''):
|
||||
self.name = name
|
||||
self.profile = name
|
||||
if profile != '':
|
||||
self.profile = profile
|
||||
|
||||
def get_keys(self):
|
||||
return {
|
||||
'capabilities:boot_option': 'local',
|
||||
'capabilities:profile': self.profile
|
||||
}
|
||||
|
|
|
@ -835,20 +835,6 @@ class TestNodeAddCapabilities(TestCase):
|
|||
self.assertEqual({'x': 'y'}, new_caps)
|
||||
|
||||
|
||||
class FakeFlavor(object):
|
||||
def __init__(self, name, profile=''):
|
||||
self.name = name
|
||||
self.profile = name
|
||||
if profile != '':
|
||||
self.profile = profile
|
||||
|
||||
def get_keys(self):
|
||||
return {
|
||||
'capabilities:boot_option': 'local',
|
||||
'capabilities:profile': self.profile
|
||||
}
|
||||
|
||||
|
||||
class TestAssignVerifyProfiles(TestCase):
|
||||
def setUp(self):
|
||||
|
||||
|
@ -857,7 +843,7 @@ class TestAssignVerifyProfiles(TestCase):
|
|||
node=mock.Mock(spec=['list', 'update']))
|
||||
self.nodes = []
|
||||
self.bm_client.node.list.return_value = self.nodes
|
||||
self.flavors = {name: (FakeFlavor(name), 1)
|
||||
self.flavors = {name: (fakes.FakeFlavor(name), 1)
|
||||
for name in ('compute', 'control')}
|
||||
|
||||
def _get_fake_node(self, profile=None, possible_profiles=[],
|
||||
|
@ -1002,7 +988,7 @@ class TestAssignVerifyProfiles(TestCase):
|
|||
|
||||
def test_no_spurious_warnings(self):
|
||||
self.nodes[:] = [self._get_fake_node(profile=None)]
|
||||
self.flavors = {'baremetal': (FakeFlavor('baremetal', None), 1)}
|
||||
self.flavors = {'baremetal': (fakes.FakeFlavor('baremetal', None), 1)}
|
||||
self._test(0, 0)
|
||||
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
import mock
|
||||
|
||||
from tripleoclient import exceptions
|
||||
from tripleoclient.tests import test_utils
|
||||
from tripleoclient.tests import fakes
|
||||
from tripleoclient.tests.v1 import test_plugin
|
||||
from tripleoclient import utils
|
||||
from tripleoclient.v1 import overcloud_profiles
|
||||
|
@ -30,8 +30,8 @@ class TestMatchProfiles(test_plugin.TestPluginV1):
|
|||
self.app.client_manager.baremetal = mock.Mock()
|
||||
self.app.client_manager.compute = mock.Mock()
|
||||
self.flavors = [
|
||||
test_utils.FakeFlavor('compute'),
|
||||
test_utils.FakeFlavor('control'),
|
||||
fakes.FakeFlavor('compute'),
|
||||
fakes.FakeFlavor('control'),
|
||||
]
|
||||
self.app.client_manager.compute.flavors.list.return_value = (
|
||||
self.flavors)
|
||||
|
|
Loading…
Reference in New Issue