From f8f2f4dcd3013a76d350242507fc75ee7309c534 Mon Sep 17 00:00:00 2001 From: Tang Chen Date: Sat, 7 Nov 2015 14:39:53 +0800 Subject: [PATCH] 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 --- .../tests/compute/v2/test_server.py | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/openstackclient/tests/compute/v2/test_server.py b/openstackclient/tests/compute/v2/test_server.py index 4f5bdd5b6a..f420ff0ada 100644 --- a/openstackclient/tests/compute/v2/test_server.py +++ b/openstackclient/tests/compute/v2/test_server.py @@ -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