diff options
| author | Jenkins <jenkins@review.openstack.org> | 2016-06-15 16:54:10 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2016-06-15 16:54:10 +0000 |
| commit | d3cd322650efeae7321bfe386e81a6697aebe5b0 (patch) | |
| tree | 3f62e99354c8f26529ee017aa3a5b87241f28aa0 /openstackclient/tests/compute | |
| parent | 4cc539fcc53c09559c9bf0f8e06743a8077db197 (diff) | |
| parent | 8e2f49fbf22c242270c8162254fc83fbb4580a24 (diff) | |
| download | python-openstackclient-d3cd322650efeae7321bfe386e81a6697aebe5b0.tar.gz | |
Merge "Support bulk deletion for commands that exist in both network and compute."
Diffstat (limited to 'openstackclient/tests/compute')
| -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 9682eec4..60abb8ef 100644 --- a/openstackclient/tests/compute/v2/fakes.py +++ b/openstackclient/tests/compute/v2/fakes.py @@ -452,6 +452,25 @@ class FakeSecurityGroup(object): return security_groups + @staticmethod + def get_security_groups(security_groups=None, count=2): + """Get an iterable MagicMock object with a list of faked security groups. + + If security groups list is provided, then initialize the Mock object + with the list. Otherwise create one. + + :param List security groups: + A list of FakeResource objects faking security groups + :param int count: + The number of security groups to fake + :return: + An iterable Mock object with side_effect set to a list of faked + security groups + """ + if security_groups is None: + security_groups = FakeSecurityGroup.create_security_groups(count) + return mock.MagicMock(side_effect=security_groups) + class FakeSecurityGroupRule(object): """Fake one or more security group rules.""" |
