summaryrefslogtreecommitdiff
path: root/openstackclient/tests/compute
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-05-17 03:04:42 +0000
committerGerrit Code Review <review@openstack.org>2016-05-17 03:04:42 +0000
commit5dfedd6445347417e8d68707ec24780f574d6b23 (patch)
tree18afd51bb6a1b4f2feac3f0c22ac1326955c5c63 /openstackclient/tests/compute
parentcb068d8c6829879144ef7d43a43e113674ab295c (diff)
parent56f9227063cb86594600ccc80c661101f0f0c2c8 (diff)
downloadpython-openstackclient-5dfedd6445347417e8d68707ec24780f574d6b23.tar.gz
Merge "Enhance exception handling for "network delete" command"
Diffstat (limited to 'openstackclient/tests/compute')
-rw-r--r--openstackclient/tests/compute/v2/fakes.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/openstackclient/tests/compute/v2/fakes.py b/openstackclient/tests/compute/v2/fakes.py
index b3f3fb49..70fc386f 100644
--- a/openstackclient/tests/compute/v2/fakes.py
+++ b/openstackclient/tests/compute/v2/fakes.py
@@ -859,6 +859,25 @@ class FakeNetwork(object):
return networks
+ @staticmethod
+ def get_networks(networks=None, count=2):
+ """Get an iterable MagicMock object with a list of faked networks.
+
+ If networks list is provided, then initialize the Mock object with the
+ list. Otherwise create one.
+
+ :param List networks:
+ A list of FakeResource objects faking networks
+ :param int count:
+ The number of networks to fake
+ :return:
+ An iterable Mock object with side_effect set to a list of faked
+ networks
+ """
+ if networks is None:
+ networks = FakeNetwork.create_networks(count=count)
+ return mock.Mock(side_effect=networks)
+
class FakeHost(object):
"""Fake one host."""