diff options
| author | Dean Troyer <dtroyer@gmail.com> | 2017-05-11 08:46:32 -0500 |
|---|---|---|
| committer | Dean Troyer <dtroyer@gmail.com> | 2017-05-11 08:47:37 -0500 |
| commit | e8f3103cc14b62226a5d71d2018b8e1c96c8a2d8 (patch) | |
| tree | 1863044c357c2a9363459a6b4dee7af2032f0f63 /openstackclient/tests/unit/common | |
| parent | c69304e3d365dc2c67fab298eba0b9097d3819da (diff) | |
| download | python-openstackclient-e8f3103cc14b62226a5d71d2018b8e1c96c8a2d8.tar.gz | |
Ignore more exceptions in quota list
Additional exceptions can be thrown here, ignore additional project
lookup exceptions, but still not all. Server failures are still
interesting, for example.
Change-Id: I9a750ae8e8efa29a36bbd1e34b50b6ace0658260
Diffstat (limited to 'openstackclient/tests/unit/common')
| -rw-r--r-- | openstackclient/tests/unit/common/test_quota.py | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/openstackclient/tests/unit/common/test_quota.py b/openstackclient/tests/unit/common/test_quota.py index 1b0d2c31..482653f4 100644 --- a/openstackclient/tests/unit/common/test_quota.py +++ b/openstackclient/tests/unit/common/test_quota.py @@ -242,7 +242,7 @@ class TestQuotaList(TestQuota): self.assertEqual(self.compute_reference_data, ret_quotas[0]) self.assertEqual(1, len(ret_quotas)) - def test_quota_list_compute_no_project(self): + def test_quota_list_compute_no_project_not_found(self): # Make one of the projects disappear self.compute.quotas.get = mock.Mock( side_effect=[ @@ -266,6 +266,53 @@ class TestQuotaList(TestQuota): self.assertEqual(self.compute_reference_data, ret_quotas[0]) self.assertEqual(1, len(ret_quotas)) + def test_quota_list_compute_no_project_4xx(self): + # Make one of the projects disappear + self.compute.quotas.get = mock.Mock( + side_effect=[ + self.compute_quotas[0], + exceptions.BadRequest("Bad request"), + ], + ) + + arglist = [ + '--compute', + ] + verifylist = [ + ('compute', True), + ] + parsed_args = self.check_parser(self.cmd, arglist, verifylist) + + columns, data = self.cmd.take_action(parsed_args) + ret_quotas = list(data) + + self.assertEqual(self.compute_column_header, columns) + self.assertEqual(self.compute_reference_data, ret_quotas[0]) + self.assertEqual(1, len(ret_quotas)) + + def test_quota_list_compute_no_project_5xx(self): + # Make one of the projects disappear + self.compute.quotas.get = mock.Mock( + side_effect=[ + self.compute_quotas[0], + exceptions.HTTPNotImplemented("Not implemented??"), + ], + ) + + arglist = [ + '--compute', + ] + verifylist = [ + ('compute', True), + ] + parsed_args = self.check_parser(self.cmd, arglist, verifylist) + + self.assertRaises( + exceptions.HTTPNotImplemented, + self.cmd.take_action, + parsed_args, + ) + def test_quota_list_network(self): # Two projects with non-default quotas self.network.get_quota = mock.Mock( |
