diff options
| author | Tang Chen <chen.tang@easystack.cn> | 2016-03-14 14:03:04 +0800 |
|---|---|---|
| committer | Tang Chen <chen.tang@easystack.cn> | 2016-04-14 13:54:14 +0800 |
| commit | 56f9227063cb86594600ccc80c661101f0f0c2c8 (patch) | |
| tree | c682b181aaf6cb831a33cfb383a310ec2f05af48 /openstackclient/tests/compute | |
| parent | be6027e09b806496d20b833a5f9ed6fcf44156b6 (diff) | |
| download | python-openstackclient-56f9227063cb86594600ccc80c661101f0f0c2c8.tar.gz | |
Enhance exception handling for "network delete" command
This patch rework "network delete" command following the
rules in doc/source/command-errors.rst.
In "network delete" command, there are multiple REST API
calls, and we should make as many of them as possible.
And log error for each one, give a better error message.
Also return a non-zero exit code.
Change-Id: I39ae087dd7bd08d049d513abfa6c5cab2bd13b2b
Partial-Bug: #1556719
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 6c67c470..c88ef85b 100644 --- a/openstackclient/tests/compute/v2/fakes.py +++ b/openstackclient/tests/compute/v2/fakes.py @@ -910,6 +910,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.""" |
