summaryrefslogtreecommitdiff
path: root/openstackclient/tests/compute/v2
diff options
context:
space:
mode:
authorTang Chen <chen.tang@easystack.cn>2016-06-17 14:39:13 +0800
committerTang Chen <chen.tang@easystack.cn>2016-07-04 10:40:00 +0800
commit50bd56db258a16199463afcdeb2f0579384cc711 (patch)
tree2965a37a6840a3a9c3b75b6d55ad1122b987dcb3 /openstackclient/tests/compute/v2
parent605efe67111790ed4801fd5b75ff314d2353d625 (diff)
downloadpython-openstackclient-50bd56db258a16199463afcdeb2f0579384cc711.tar.gz
Transfer "ip floating pool list" to "floating ip pool list"
This patch does the following things to transfer "ip floating pool list" to "floating ip pool list": * Add a new command "floating ip pool list" to deprecate "ip floating pool list". The source code is in network/v2 dir. * Add doc for "floating ip pool list". * Add floating ip pool unit tests. Change-Id: Id410f4e4a96cf589a6e8def209574da71395b55f Implements: blueprint rework-ip-commands Partial-bug: 1555990 Co-Authored-By: Dean Troyer <dtroyer@gmail.com>
Diffstat (limited to 'openstackclient/tests/compute/v2')
-rw-r--r--openstackclient/tests/compute/v2/fakes.py51
1 files changed, 51 insertions, 0 deletions
diff --git a/openstackclient/tests/compute/v2/fakes.py b/openstackclient/tests/compute/v2/fakes.py
index b9add2c8..f9b1f75f 100644
--- a/openstackclient/tests/compute/v2/fakes.py
+++ b/openstackclient/tests/compute/v2/fakes.py
@@ -178,6 +178,9 @@ class FakeComputev2Client(object):
self.floating_ips = mock.Mock()
self.floating_ips.resource_class = fakes.FakeResource(None, {})
+ self.floating_ip_pools = mock.Mock()
+ self.floating_ip_pools.resource_class = fakes.FakeResource(None, {})
+
self.networks = mock.Mock()
self.networks.resource_class = fakes.FakeResource(None, {})
@@ -971,6 +974,54 @@ class FakeFloatingIP(object):
return mock.MagicMock(side_effect=floating_ips)
+class FakeFloatingIPPool(object):
+ """Fake one or more floating ip pools."""
+
+ @staticmethod
+ def create_one_floating_ip_pool(attrs=None):
+ """Create a fake floating ip pool.
+
+ :param Dictionary attrs:
+ A dictionary with all attributes
+ :return:
+ A FakeResource object, with id, etc
+ """
+ if attrs is None:
+ attrs = {}
+
+ # Set default attributes.
+ floating_ip_pool_attrs = {
+ 'name': 'floating-ip-pool-name-' + uuid.uuid4().hex,
+ }
+
+ # Overwrite default attributes.
+ floating_ip_pool_attrs.update(attrs)
+
+ floating_ip_pool = fakes.FakeResource(
+ info=copy.deepcopy(floating_ip_pool_attrs),
+ loaded=True)
+
+ return floating_ip_pool
+
+ @staticmethod
+ def create_floating_ip_pools(attrs=None, count=2):
+ """Create multiple fake floating ip pools.
+
+ :param Dictionary attrs:
+ A dictionary with all attributes
+ :param int count:
+ The number of floating ip pools to fake
+ :return:
+ A list of FakeResource objects faking the floating ip pools
+ """
+ floating_ip_pools = []
+ for i in range(0, count):
+ floating_ip_pools.append(
+ FakeFloatingIPPool.create_one_floating_ip_pool(attrs)
+ )
+ return floating_ip_pools
+
+
class FakeNetwork(object):
"""Fake one or more networks."""