diff options
| author | Jenkins <jenkins@review.openstack.org> | 2016-06-16 16:30:23 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2016-06-16 16:30:23 +0000 |
| commit | c33a213cf189efdc47e2840eab1a43b8b4f3f899 (patch) | |
| tree | 4cda6201f2d4aa3dc81f07b8f3a7466ab7fa3754 /openstackclient/tests/network/v2/fakes.py | |
| parent | 5d23a1208aeb25914ab12eff665ee373f1167c6d (diff) | |
| parent | 041ea4978b94149d5037b5afc7743db939b75331 (diff) | |
| download | python-openstackclient-c33a213cf189efdc47e2840eab1a43b8b4f3f899.tar.gz | |
Merge "Support bulk deletion for delete commands in networkv2"
Diffstat (limited to 'openstackclient/tests/network/v2/fakes.py')
| -rw-r--r-- | openstackclient/tests/network/v2/fakes.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/openstackclient/tests/network/v2/fakes.py b/openstackclient/tests/network/v2/fakes.py index 6b09e297..a23efc2d 100644 --- a/openstackclient/tests/network/v2/fakes.py +++ b/openstackclient/tests/network/v2/fakes.py @@ -771,6 +771,25 @@ class FakeSubnet(object): return subnets + @staticmethod + def get_subnets(subnets=None, count=2): + """Get an iterable MagicMock object with a list of faked subnets. + + If subnets list is provided, then initialize the Mock object + with the list. Otherwise create one. + + :param List subnets: + A list of FakeResource objects faking subnets + :param int count: + The number of subnets to fake + :return: + An iterable Mock object with side_effect set to a list of faked + subnets + """ + if subnets is None: + subnets = FakeSubnet.create_subnets(count) + return mock.MagicMock(side_effect=subnets) + class FakeFloatingIP(object): """Fake one or more floating ip.""" @@ -910,3 +929,22 @@ class FakeSubnetPool(object): ) return subnet_pools + + @staticmethod + def get_subnet_pools(subnet_pools=None, count=2): + """Get an iterable MagicMock object with a list of faked subnet pools. + + If subnet_pools list is provided, then initialize the Mock object + with the list. Otherwise create one. + + :param List subnet pools: + A list of FakeResource objects faking subnet pools + :param int count: + The number of subnet pools to fake + :return: + An iterable Mock object with side_effect set to a list of faked + subnet pools + """ + if subnet_pools is None: + subnet_pools = FakeSubnetPool.create_subnet_pools(count) + return mock.MagicMock(side_effect=subnet_pools) |
