Migrate flavor usage in test_create_server to request_mock
Don't fix the whole tests, since it does a bunch of neutron introspection. Also, make sure it doesn't call neutron yet. We'll get to that when we migrate neutron calls. Change-Id: I9faaecedb6c888119e0c1370e9c6ca1a2f6a2fb8
This commit is contained in:
parent
2e79cffb98
commit
7d982af93e
@ -26,7 +26,7 @@ from shade.tests import fakes
|
|||||||
from shade.tests.unit import base
|
from shade.tests.unit import base
|
||||||
|
|
||||||
|
|
||||||
class TestCreateServer(base.TestCase):
|
class TestCreateServer(base.RequestsMockTestCase):
|
||||||
|
|
||||||
def test_create_server_with_create_exception(self):
|
def test_create_server_with_create_exception(self):
|
||||||
"""
|
"""
|
||||||
@ -308,11 +308,16 @@ class TestCreateServer(base.TestCase):
|
|||||||
network='network-name', nics=[])
|
network='network-name', nics=[])
|
||||||
mock_get_network.assert_called_once_with(name_or_id='network-name')
|
mock_get_network.assert_called_once_with(name_or_id='network-name')
|
||||||
|
|
||||||
|
@mock.patch.object(OpenStackCloud, 'get_server_by_id')
|
||||||
@mock.patch.object(OpenStackCloud, 'get_image')
|
@mock.patch.object(OpenStackCloud, 'get_image')
|
||||||
@mock.patch.object(OpenStackCloud, 'nova_client')
|
@mock.patch.object(OpenStackCloud, 'nova_client')
|
||||||
def test_create_server_get_flavor_image(
|
def test_create_server_get_flavor_image(
|
||||||
self, mock_nova, mock_image):
|
self, mock_nova, mock_image, mock_get_server_by_id):
|
||||||
|
self.register_uri(
|
||||||
|
'GET', '{endpoint}/flavors/detail?is_public=None'.format(
|
||||||
|
endpoint=fakes.ENDPOINT),
|
||||||
|
json={'flavors': fakes.FAKE_FLAVOR_LIST})
|
||||||
self.cloud.create_server(
|
self.cloud.create_server(
|
||||||
'server-name', 'image-id', 'flavor-id')
|
'server-name', 'image-id', 'vanilla',
|
||||||
mock_nova.flavors.list.assert_called_once()
|
nics=[{'net-id': 'some-network'}])
|
||||||
mock_image.assert_called_once()
|
mock_image.assert_called_once()
|
||||||
|
Loading…
Reference in New Issue
Block a user