summaryrefslogtreecommitdiff
path: root/cinderclient/tests/unit/test_exceptions.py
Commit message (Collapse)AuthorAgeFilesLines
* Use unittest.mock instead of third party mockSean McGinnis2020-06-051-1/+2
| | | | | | | | Now that we no longer support py27, we can use the standard library unittest.mock module instead of the third party mock lib. Change-Id: Ia41326a601dfd72750bd81c3ebee9ec5884ad91b Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
* Cinder client should retry with Retry-After valueYuriy Nesenenko2016-07-061-0/+32
| | | | | | | | | | | | | | | | | | | If a request fails but the response contains a "Retry-After", the cinder client should wait the amount of time and then retry. Cinder client should report a warning to user and continue with retry, so that user can cancel the operation if not interested in retry. The value in "Retry-After" header will be in seconds or GMT value, client should handle both the cases. How many times client should retry will be controlled by user through "--retries" argument to cinder api example, $ cinder --retries 3 availability-zone-list If request was not sucessful within the retries, client should raise the exception. Change-Id: I99af957bfbbe3a202b148dc2fcafdd20b5d7cda0 Partial-Bug: #1263069
* Fix ClientException init when there is no message on py34Matt Riedemann2015-08-041-0/+32
BaseException.message was removed in python 3 per PEP 0352 so if no message is passed to the ClientException __init__ it will blow up: AttributeError: type object 'ClientException' has no attribute 'message' So this change does two things: 1. Default to 'n/a' for message and details when body['keys'] doesn't have a message or details in it (which should be fine since from_response defaults to n/a if 'keys' is not in body). 2. Use getattr for self.__class__.message and default to None if that attribute is not set. Arguably we could just remove this and make the message kwarg default to 'n/a' in ClientException.__init__ but I figured that was more invasive. Closes-Bug: #1481478 Change-Id: I738cb9c8d4f015048c45a1df16bf18e29190e392