Merge "Use fake server name instead of id when testing "server_name" param."

This commit is contained in:
Jenkins 2015-11-08 13:59:04 +00:00 committed by Gerrit Code Review
commit 1cf09be913

View File

@ -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