diff options
| author | Jenkins <jenkins@review.openstack.org> | 2016-07-06 13:50:31 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2016-07-06 13:50:32 +0000 |
| commit | 8d5a0fd86e24bc8d992308c63a85e5bd7e76bb90 (patch) | |
| tree | cde075077ac698927177996c2b8adc278654921f /openstackclient/tests/compute | |
| parent | 472d4532e6d5273abc07b2c637a1a9de9115a906 (diff) | |
| parent | 50bd56db258a16199463afcdeb2f0579384cc711 (diff) | |
| download | python-openstackclient-8d5a0fd86e24bc8d992308c63a85e5bd7e76bb90.tar.gz | |
Merge "Transfer "ip floating pool list" to "floating ip pool list""
Diffstat (limited to 'openstackclient/tests/compute')
| -rw-r--r-- | openstackclient/tests/compute/v2/fakes.py | 51 |
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.""" |
