Use fake server name instead of id when testing "server_name" param.
"server create" command takes a server name parameter. The server id is generated by openstack. When we intended to pass a server name to the unit tests of "server create" command, we passed server id. It won't be any problem because the fake server id is also a string, but we should pass a fake server name because we have a string to fake one. Change-Id: I9944f0ea2a6c457e4fad8215a54778bca08965ab
This commit is contained in:
parent
8a1fb85dba
commit
f8f2f4dcd3
@ -85,10 +85,10 @@ class TestServerCreate(TestServer):
|
|||||||
|
|
||||||
def test_server_create_no_options(self):
|
def test_server_create_no_options(self):
|
||||||
arglist = [
|
arglist = [
|
||||||
compute_fakes.server_id,
|
compute_fakes.server_name,
|
||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('server_name', compute_fakes.server_id),
|
('server_name', compute_fakes.server_name),
|
||||||
]
|
]
|
||||||
try:
|
try:
|
||||||
# Missing required args should bail here
|
# Missing required args should bail here
|
||||||
@ -100,13 +100,13 @@ class TestServerCreate(TestServer):
|
|||||||
arglist = [
|
arglist = [
|
||||||
'--image', 'image1',
|
'--image', 'image1',
|
||||||
'--flavor', 'flavor1',
|
'--flavor', 'flavor1',
|
||||||
compute_fakes.server_id,
|
compute_fakes.server_name,
|
||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('image', 'image1'),
|
('image', 'image1'),
|
||||||
('flavor', 'flavor1'),
|
('flavor', 'flavor1'),
|
||||||
('config_drive', False),
|
('config_drive', False),
|
||||||
('server_name', compute_fakes.server_id),
|
('server_name', compute_fakes.server_name),
|
||||||
]
|
]
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ class TestServerCreate(TestServer):
|
|||||||
)
|
)
|
||||||
# ServerManager.create(name, image, flavor, **kwargs)
|
# ServerManager.create(name, image, flavor, **kwargs)
|
||||||
self.servers_mock.create.assert_called_with(
|
self.servers_mock.create.assert_called_with(
|
||||||
compute_fakes.server_id,
|
compute_fakes.server_name,
|
||||||
self.image,
|
self.image,
|
||||||
self.flavor,
|
self.flavor,
|
||||||
**kwargs
|
**kwargs
|
||||||
@ -154,14 +154,14 @@ class TestServerCreate(TestServer):
|
|||||||
'--flavor', 'flavor1',
|
'--flavor', 'flavor1',
|
||||||
'--nic', 'net-id=net1',
|
'--nic', 'net-id=net1',
|
||||||
'--nic', 'port-id=port1',
|
'--nic', 'port-id=port1',
|
||||||
compute_fakes.server_id,
|
compute_fakes.server_name,
|
||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('image', 'image1'),
|
('image', 'image1'),
|
||||||
('flavor', 'flavor1'),
|
('flavor', 'flavor1'),
|
||||||
('nic', ['net-id=net1', 'port-id=port1']),
|
('nic', ['net-id=net1', 'port-id=port1']),
|
||||||
('config_drive', False),
|
('config_drive', False),
|
||||||
('server_name', compute_fakes.server_id),
|
('server_name', compute_fakes.server_name),
|
||||||
]
|
]
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
|
||||||
@ -207,7 +207,7 @@ class TestServerCreate(TestServer):
|
|||||||
)
|
)
|
||||||
# ServerManager.create(name, image, flavor, **kwargs)
|
# ServerManager.create(name, image, flavor, **kwargs)
|
||||||
self.servers_mock.create.assert_called_with(
|
self.servers_mock.create.assert_called_with(
|
||||||
compute_fakes.server_id,
|
compute_fakes.server_name,
|
||||||
self.image,
|
self.image,
|
||||||
self.flavor,
|
self.flavor,
|
||||||
**kwargs
|
**kwargs
|
||||||
@ -234,14 +234,14 @@ class TestServerCreate(TestServer):
|
|||||||
'--image', 'image1',
|
'--image', 'image1',
|
||||||
'--flavor', 'flavor1',
|
'--flavor', 'flavor1',
|
||||||
'--user-data', 'userdata.sh',
|
'--user-data', 'userdata.sh',
|
||||||
compute_fakes.server_id,
|
compute_fakes.server_name,
|
||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('image', 'image1'),
|
('image', 'image1'),
|
||||||
('flavor', 'flavor1'),
|
('flavor', 'flavor1'),
|
||||||
('user_data', 'userdata.sh'),
|
('user_data', 'userdata.sh'),
|
||||||
('config_drive', False),
|
('config_drive', False),
|
||||||
('server_name', compute_fakes.server_id),
|
('server_name', compute_fakes.server_name),
|
||||||
]
|
]
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
|
||||||
@ -272,7 +272,7 @@ class TestServerCreate(TestServer):
|
|||||||
)
|
)
|
||||||
# ServerManager.create(name, image, flavor, **kwargs)
|
# ServerManager.create(name, image, flavor, **kwargs)
|
||||||
self.servers_mock.create.assert_called_with(
|
self.servers_mock.create.assert_called_with(
|
||||||
compute_fakes.server_id,
|
compute_fakes.server_name,
|
||||||
self.image,
|
self.image,
|
||||||
self.flavor,
|
self.flavor,
|
||||||
**kwargs
|
**kwargs
|
||||||
|
Loading…
Reference in New Issue
Block a user