diff options
| author | Huanxuan Ao <huanxuan.ao@easystack.cn> | 2016-06-27 11:04:05 +0800 |
|---|---|---|
| committer | Steve Martinelli <s.martinelli@gmail.com> | 2016-06-27 20:39:23 +0000 |
| commit | af7ab03693a5708102cf6746563da289e4c1e3b7 (patch) | |
| tree | 9d87de733c25d044deab1732e595f9f1adee454c /openstackclient/tests/compute/v2/fakes.py | |
| parent | 044a46ed5f040020cf80adc1ace987802344e87d (diff) | |
| download | python-openstackclient-af7ab03693a5708102cf6746563da289e4c1e3b7.tar.gz | |
Support bulk deletion for delete commands in computev2
Support bulk deletion and error handling for "keypair delete"
and "service delete" commands in computev2.
Up to now, all the delete commands in computev2 support bulk
deletion.
Change-Id: I6d5c960e9716188e56615514d0921618a15a88ec
Partially-Implements: blueprint multi-argument-compute
Partial-Bug: #1592906
Diffstat (limited to 'openstackclient/tests/compute/v2/fakes.py')
| -rw-r--r-- | openstackclient/tests/compute/v2/fakes.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/openstackclient/tests/compute/v2/fakes.py b/openstackclient/tests/compute/v2/fakes.py index b7f17fbc..882d8480 100644 --- a/openstackclient/tests/compute/v2/fakes.py +++ b/openstackclient/tests/compute/v2/fakes.py @@ -826,6 +826,25 @@ class FakeKeypair(object): return keypairs + @staticmethod + def get_keypairs(keypairs=None, count=2): + """Get an iterable MagicMock object with a list of faked keypairs. + + If keypairs list is provided, then initialize the Mock object with the + list. Otherwise create one. + + :param List keypairs: + A list of FakeResource objects faking keypairs + :param int count: + The number of keypairs to fake + :return: + An iterable Mock object with side_effect set to a list of faked + keypairs + """ + if keypairs is None: + keypairs = FakeKeypair.create_keypairs(count) + return mock.MagicMock(side_effect=keypairs) + class FakeAvailabilityZone(object): """Fake one or more compute availability zones (AZs).""" |
