summaryrefslogtreecommitdiff
path: root/cinderclient/tests/unit/test_api_versions.py
Commit message (Collapse)AuthorAgeFilesLines
* Remove v2 support from the shellBrian Rosmaita2021-07-121-19/+20
| | | | | | | | | | | | Also removes the v2 support from the generic client and restores a skipped test. Additionally, the cinderclient.tests.v2.test_availablity_zone module depends on the v2.shell class, so move that module to v3, update the v3 AvailablityZone class, and make appropriate adjustments to the tests and test fixtures. Change-Id: I7a3cca15f5944141d510a75af6684221c297963b
* Remove all usage of six libraryhaixin2021-03-041-2/+1
| | | | | | Replace six with Python 3 style code. Change-Id: I4b97e040f3e790ac114dcd43c68e6b67b1079adf
* Use unittest.mock instead of third party mockSean McGinnis2020-06-051-3/+3
| | | | | | | | 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>
* Correct discover_version responseBrian Rosmaita2019-04-251-1/+6
| | | | | | | | | | The discover_version function was ignoring the max microversion supported by the client. This patch corrects its behavior to return the most recent API version, if any, supported by both the client and the server it is communicating with. Closes-bug: #1826286 Change-Id: If22b72452065080b24cb1b899c5a5a88b809e986
* Replace assertRaisesRegexp with assertRaisesRegexzhangyangyang2018-08-291-6/+6
| | | | | | | This replaces the deprecated (in python 3.2) unittest.TestCase method assertRaisesRegexp() with assertRaisesRegex(). Change-Id: I85025ad141f8436913ba192716435ce63e1e2d05
* Enable H306Eric Harney2017-08-011-1/+2
| | | | | | | | | Enforce ordering of imports with H306. For tests, this is mostly done by grouping test imports after other cinderclient imports. Change-Id: Ie40fda014d1aedb057e5b4ea1f27f999c84e6373
* Handle AttributeError in _get_server_version_rangeMatt Riedemann2017-05-311-0/+9
| | | | | | | | | | | | | | | | | | _get_server_version_range only supports a v3 client object because ServiceManager.server_api_version() is only implemented for the v3 client code. If you're trying to call this with a v1 or v2 client object, it will raise an AttributeError which is unhelpful for the end python API client. This change handles the AttributeError and returns a more useful error with an explanation of how the client code is wrong. We could alternatively set versions = None and let it return two empty APIVersion objects, but that seems confusing. This change opts to be explicit about the failure. Change-Id: I2266999df6332b8c5fb0ec808db69bcc847effb0 Closes-Bug: #1694739
* Add get_highest_version methodscottda2017-03-101-0/+6
| | | | | | | Add method to query a server that supports /v3 endpoint and get the highest supported microversion. Change-Id: If179760787526440c852803eafaf9617bcd2d36e
* Fix discover_versionscottda2017-03-091-0/+69
| | | | | | | | | | | discover_version needs to find the proper module for server_api_version method, and it needs to properly parse a list of versions. Do some refactor to clean things up. Add unit tests. Co-Authored-By: waj334 <justin.wilson@intel.com> Change-Id: I742bc33074cc55fe5f9682b8b97a82573c51183f Closes-Bug: #1632872
* Modify assertTruezheng yin2016-09-111-6/+6
| | | | | | For example: assertTrue(v1<v2) is equal to assertLess(v1,v2) Change-Id: Ic4a0e80eab167079631ac7dc054ad4d2a8a02fab
* Make APIVersion's null check more pythonicGorka Eguileor2016-08-291-3/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | Our current APIVersion object has an is_null method to check when the version instance is null (major=0 and minor=0). While this works it is not very pythonic, since you have to write expressions such as: if not min_version and not max_version: return True elif ((min_version and max_version) and max_version.is_null() and min_version.is_null()): return True This patch removes the is_null method and instead implements the truth value testing to simplify expressions and make code more pythonic. So previous code would just look like: if not min_version and not max_version: return True Because this will work with min_version being None or being an APIVersion instance with major=0 and minor=0. Change-Id: I7497c5dc940c1e726507117cadbad232d8c1d80d
* Fix useless api_version of Manager classCao ShuFeng2016-08-231-0/+33
| | | | | | | | | | | | | | | | | Manager's api_version property is used by api_version.wraps. It should not be an "empty" class and the real api_version can be read from Client class. The 3.0 version's upload-to-image doesn't work as excepted because of this useless api_version of VolumeManager class. This patch also fix it and update some unit tests for it, because the changes are co-dependent on one another. Co-Authored-By: Nate Potter <nathaniel.potter@intel.com> Change-Id: I398cbd02b61f30918a427291d1d3ae00435e0f4c Closes-Bug: #1573414 Closes-Bug: #1589040
* Support api-microversionsscottda2016-04-191-0/+141
Changes to cinderclient to use microversions. Implements: blueprint api-microversion-support-for-cinderclient api-microversion-support-for-cinderclient Change-Id: I840a1162b88e8ff36fa3fc4e1d6b9317104df3e0