diff options
| author | Huanxuan Ao <huanxuan.ao@easystack.cn> | 2016-06-16 13:09:27 +0800 |
|---|---|---|
| committer | Steve Martinelli <s.martinelli@gmail.com> | 2016-06-16 12:46:32 +0000 |
| commit | 041ea4978b94149d5037b5afc7743db939b75331 (patch) | |
| tree | 4565fc45b7ded8a2033dcad7a160de3802424562 /openstackclient/tests/network/v2/fakes.py | |
| parent | 114eeeb0236d29a325abbf13b41a9a385746b367 (diff) | |
| download | python-openstackclient-041ea4978b94149d5037b5afc7743db939b75331.tar.gz | |
Support bulk deletion for delete commands in networkv2
This patch support bulk deletion for delete commands below:
1.subnet delete
2.subnet pool delete
Up to now, all the delete commands in networkv2 support bulk deletion.
Change-Id: I63f6d1d02bad1fcc26e72b7028b53958a68ce2dc
Partially-Implements: blueprint multi-argument-network
Partial-Bug: #1592906
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) |
