diff options
| author | Dean Troyer <dtroyer@gmail.com> | 2017-04-17 15:03:14 -0500 |
|---|---|---|
| committer | Dean Troyer <dtroyer@gmail.com> | 2017-04-18 08:57:34 -0500 |
| commit | 107cad200a15a3131525436b483dbef5e88b9508 (patch) | |
| tree | 98d70d245837e533fd407ce84634485a25a5f50a /openstackclient/tests/unit/network/v2 | |
| parent | 7e1350815e09e0aa669c0ad9d5d3c041ca505b89 (diff) | |
| download | python-openstackclient-107cad200a15a3131525436b483dbef5e88b9508.tar.gz | |
Low-level Compute v2 API: floating ip pool
api.compute.APIv2 floating ip pool function.
novaclient 8.0 is now released without support for the previously
deprecated nova-net functions, so include a new low-level REST
implementation of the removed APIs.
Also includes a handful of cleanups that the previous security group and
floating IP reviews missed.
Change-Id: I20116ec4fc1113857d8d917bfb30fa3170d05b9f
Diffstat (limited to 'openstackclient/tests/unit/network/v2')
| -rw-r--r-- | openstackclient/tests/unit/network/v2/test_floating_ip_compute.py | 4 | ||||
| -rw-r--r-- | openstackclient/tests/unit/network/v2/test_floating_ip_pool_compute.py | 19 |
2 files changed, 11 insertions, 12 deletions
diff --git a/openstackclient/tests/unit/network/v2/test_floating_ip_compute.py b/openstackclient/tests/unit/network/v2/test_floating_ip_compute.py index 0d58c158..df47e63e 100644 --- a/openstackclient/tests/unit/network/v2/test_floating_ip_compute.py +++ b/openstackclient/tests/unit/network/v2/test_floating_ip_compute.py @@ -103,10 +103,6 @@ class TestDeleteFloatingIPCompute(TestFloatingIPCompute): self.app.client_manager.network_endpoint_enabled = False - # Return value of utils.find_resource() - self.compute.floating_ips.get = ( - compute_fakes.FakeFloatingIP.get_floating_ips(self._floating_ips)) - # Get the command object to test self.cmd = fip.DeleteFloatingIP(self.app, None) diff --git a/openstackclient/tests/unit/network/v2/test_floating_ip_pool_compute.py b/openstackclient/tests/unit/network/v2/test_floating_ip_pool_compute.py index 8db21430..591f58ca 100644 --- a/openstackclient/tests/unit/network/v2/test_floating_ip_pool_compute.py +++ b/openstackclient/tests/unit/network/v2/test_floating_ip_pool_compute.py @@ -11,6 +11,8 @@ # under the License. # +import mock + from openstackclient.network.v2 import floating_ip_pool from openstackclient.tests.unit.compute.v2 import fakes as compute_fakes @@ -26,10 +28,13 @@ class TestFloatingIPPoolCompute(compute_fakes.TestComputev2): self.compute = self.app.client_manager.compute +@mock.patch( + 'openstackclient.api.compute_v2.APIv2.floating_ip_pool_list' +) class TestListFloatingIPPoolCompute(TestFloatingIPPoolCompute): # The floating ip pools to list up - floating_ip_pools = \ + _floating_ip_pools = \ compute_fakes.FakeFloatingIPPool.create_floating_ip_pools(count=3) columns = ( @@ -37,9 +42,9 @@ class TestListFloatingIPPoolCompute(TestFloatingIPPoolCompute): ) data = [] - for pool in floating_ip_pools: + for pool in _floating_ip_pools: data.append(( - pool.name, + pool['name'], )) def setUp(self): @@ -47,19 +52,17 @@ class TestListFloatingIPPoolCompute(TestFloatingIPPoolCompute): self.app.client_manager.network_endpoint_enabled = False - self.compute.floating_ip_pools.list.return_value = \ - self.floating_ip_pools - # Get the command object to test self.cmd = floating_ip_pool.ListFloatingIPPool(self.app, None) - def test_floating_ip_list(self): + def test_floating_ip_list(self, fipp_mock): + fipp_mock.return_value = self._floating_ip_pools arglist = [] verifylist = [] parsed_args = self.check_parser(self.cmd, arglist, verifylist) columns, data = self.cmd.take_action(parsed_args) - self.compute.floating_ip_pools.list.assert_called_once_with() + fipp_mock.assert_called_once_with() self.assertEqual(self.columns, columns) self.assertEqual(self.data, list(data)) |
