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:
Tang Chen 2015-11-07 14:39:53 +08:00
parent 8a1fb85dba
commit f8f2f4dcd3

View File

@ -85,10 +85,10 @@ class TestServerCreate(TestServer):
def test_server_create_no_options(self):
arglist = [
compute_fakes.server_id,
compute_fakes.server_name,
]
verifylist = [
('server_name', compute_fakes.server_id),
('server_name', compute_fakes.server_name),
]
try:
# Missing required args should bail here
@ -100,13 +100,13 @@ class TestServerCreate(TestServer):
arglist = [
'--image', 'image1',
'--flavor', 'flavor1',
compute_fakes.server_id,
compute_fakes.server_name,
]
verifylist = [
('image', 'image1'),
('flavor', 'flavor1'),
('config_drive', False),
('server_name', compute_fakes.server_id),
('server_name', compute_fakes.server_name),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -131,7 +131,7 @@ class TestServerCreate(TestServer):
)
# ServerManager.create(name, image, flavor, **kwargs)
self.servers_mock.create.assert_called_with(
compute_fakes.server_id,
compute_fakes.server_name,
self.image,
self.flavor,
**kwargs
@ -154,14 +154,14 @@ class TestServerCreate(TestServer):
'--flavor', 'flavor1',
'--nic', 'net-id=net1',
'--nic', 'port-id=port1',
compute_fakes.server_id,
compute_fakes.server_name,
]
verifylist = [
('image', 'image1'),
('flavor', 'flavor1'),
('nic', ['net-id=net1', 'port-id=port1']),
('config_drive', False),
('server_name', compute_fakes.server_id),
('server_name', compute_fakes.server_name),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -207,7 +207,7 @@ class TestServerCreate(TestServer):
)
# ServerManager.create(name, image, flavor, **kwargs)
self.servers_mock.create.assert_called_with(
compute_fakes.server_id,
compute_fakes.server_name,
self.image,
self.flavor,
**kwargs
@ -234,14 +234,14 @@ class TestServerCreate(TestServer):
'--image', 'image1',
'--flavor', 'flavor1',
'--user-data', 'userdata.sh',
compute_fakes.server_id,
compute_fakes.server_name,
]
verifylist = [
('image', 'image1'),
('flavor', 'flavor1'),
('user_data', 'userdata.sh'),
('config_drive', False),
('server_name', compute_fakes.server_id),
('server_name', compute_fakes.server_name),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -272,7 +272,7 @@ class TestServerCreate(TestServer):
)
# ServerManager.create(name, image, flavor, **kwargs)
self.servers_mock.create.assert_called_with(
compute_fakes.server_id,
compute_fakes.server_name,
self.image,
self.flavor,
**kwargs