summaryrefslogtreecommitdiff
path: root/cinderclient/tests/unit/test_utils.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix encoding of query parametersGoutham Pacha Ravi2018-09-131-13/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | IETF RFC 3986 classifies "~" as a reserved character [1], however until python3.7 [2], python's url parsing used to encode this character. urllib has seen a lot of churn in various python releases, and hence we were using a six wrapper to shield ourselves, however, this backwards-incompatible change in encoding norms forces us to deal with the problem at our end. Cinder's API accepts "~" in both, its encoded or un-encoded forms. So, let's stop encoding it within cinderclient, regardless of the version of python running it. Also fix an inconsitency around the use of the generic helper method in utils added in I3a3ae90cc6011d1aa0cc39db4329d9bc08801904 (cinderclient/utils.py - build_query_param) to allow for False as a value in the query. [1] https://tools.ietf.org/html/rfc3986.html [2] https://docs.python.org/3/library/urllib.parse.html#url-quoting Change-Id: I89809694ac3e4081ce83fd4f788f9355d6772f59 Closes-Bug: #1784728
* Enable F811, F821Eric Harney2017-08-231-1/+1
| | | | | | | | | F811 is a little noisy with api_versions.wraps() decorated methods, but opting to disable it in these cases seems better than missing problems in the rest of the code. Change-Id: I9c46938ab2a442e55f96b5ab6c119c4475afaecd
* Enable H306Eric Harney2017-08-011-2/+3
| | | | | | | | | Enforce ordering of imports with H306. For tests, this is mostly done by grouping test imports after other cinderclient imports. Change-Id: Ie40fda014d1aedb057e5b4ea1f27f999c84e6373
* Add pagination for snapshots, backupsGerhard Muntingh2017-06-221-1/+1
| | | | | | | | | | | | | | Allow cinderclient to retrieve more than osapi_max_limit (default 1000) snapshots, backups, etc. Cinder pagination support has been added to the API quite some time ago. Client support was only implemented for volumes. This commit allows other resources to be paginated as well. Change-Id: I9a6f446b680dadedccd14ba49efdef7f5ef0a58a Closes-Bug: #1691229 Co-Authored-By: Gorka Eguileor <geguileo@redhat.com>
* Merge "Support list-volume for group show"Jenkins2017-06-141-2/+14
|\
| * Support list-volume for group showwangxiyuan2017-05-251-2/+14
| | | | | | | | | | | | | | | | | | | | V3.25 support query groups with volumes, this patch add the client support. Partial-Implements: blueprint improvement-to-query-consistency-group-detail Partial-Bug: #1663474 Change-Id: Ic0d86b9265f295877eebca97ff450f5efd73b184
* | Support generalized resource filter in clientTommyLike2017-05-311-0/+17
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce new command 'list-filters' to retrieve enabled resource filters. ``` command: cinder list-filters --resource=volume output: +----------------+-------------------------------+ | Resource | Filters | +----------------+-------------------------------+ | volume | name, status, image_metadata | +----------------+-------------------------------+ ``` Also Added new option '--filters' to these list commands: 1. list 2. snapshot-list 3. backup-list 4. attachment-list 5. message-list 6. group-list 7. group-snapshot-list 8. get-pools Change-Id: I062e6227342ea0d940a8333e84014969c33b49df Partial: blueprint generalized-filtering-for-cinder-list-resource Depends-On: 04bd22c1eb371805a3ce9f6c8915325bc0da2d36 Depends-On: 7fdc4688fea373afb85d929e649d311568d1855a
* Pretty print 'extra_specs' and 'group_specs'TommyLike2017-05-121-0/+22
| | | | | | | | | | | | | Now we have 'extra_specs', 'group_specs' pretty printed. +-------------+---------------+ | other_key | value | | extra_specs | key1 : value1 | | | key2 : value2 | +-------------+---------------+ Change-Id: I3500f148f29bad89aacc89ad12a993edf4f7d460
* Remove extra 'u' from cli outputCao ShuFeng2016-12-161-2/+9
| | | | | | | | | | | | | The unicode_key_value_to_string() function is designed to remove extra 'u' in cinderclient cli output. However this patch[1] bring the extra 'u' back. Let's remove the extra 'u' again. Closes-bug: #1615921 Closes-bug: #1606904 [1] https://review.openstack.org/#/c/342734/ Change-Id: I26f0ad7149f57e935953c2398ba90b7b3585e201
* Optimize: add build_query_param method to clean codeTommyLike2016-11-071-0/+40
| | | | | | | | Currently the client build query params in respective method this patch intends to use 'utils.build_query_param' to make the code clean. Change-Id: I3a3ae90cc6011d1aa0cc39db4329d9bc08801904
* Move old oslo-incubator code out of openstack/commondineshbhor2016-11-031-1/+1
| | | | | | | | | | | | | | As part of the first community-wide goal, teams were asked to remove the openstack/common package of their projects if one existed. This was a byproduct of the old oslo-incubator form of syncing common functionality. The package, apiclient, was moved to a top level location and cliutils was moved to the common module. There are no oslo specific libraries, the recommended solution is to move it in tree and maintain it there. Change-Id: Iee52004bd33c19d63133577ff466164b85fd6ca6
* Fix useless api_version of Manager classCao ShuFeng2016-08-231-0/+12
| | | | | | | | | | | | | | | | | 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
* Fix Unicode error printing extra-specsYuriy Nesenenko2016-07-151-0/+4
| | | | | | | | | If type-key is set to unicode the command cinder extra-specs-list fails with the ERROR: 'ascii' codec can't encode characters in position. This patch fixes it. Change-Id: Id82bfbe8870351605f53c7ca029b9aa7e6089f6a Closes-Bug: #1568937
* Fix the incorrect alignmentxiexs2016-05-191-8/+8
| | | | | | | | | The "aligns" attribute no longer exists in the Prettytable, "align" instead. So we should use "align" attribute to force the output with left alignment by default. Change-Id: I97b30216000b6e31c1bef614cf0b0d68ab8cfb08 Closes-Bug: #1583880
* Fix omission of request_ids returned to userCao Shufeng2016-02-171-1/+9
| | | | | | | | | | | | ManagerWithFind's find() and findall() function is exposed to users as ManagerWithFind is parent class of VolumeManager, SnapshotManager, etc. When the find() and findall() function is called by users, they should also return request_ids to users. Change-Id: I87dca61f96ff9cf4dc9a443a46d7f559e8b3026f Closes-Bug: 1545975
* Fixes table when there are multiline in result dataliyingjun2015-08-031-0/+34
| | | | | | | | The table doesn't display right when there are multiple line in result data. Fixes this by replace "\r" with " ". Change-Id: I0b994466f3c65ea973e80d9f03ca9a248147d49d Closes-bug: #1476462
* Find resource refactoringAnton Arefiev2015-05-121-8/+25
| | | | | | | | | | | | | The 'name' field for some resources is called something different, for example 'display_name' for volumes, 'name' for volumes type. So class 'resource' has attribute 'NAME_ATTR' wich contains attribute name for different resources. This change removes reduntant call find in resource manager, instead of it checks NAME_ATTR value. Related-Bug: #1449444 Change-Id: Ide334d7535c73cbdff72c30319eb539d8f5304d6
* Remove duplicate find request in find_resourceGorka Eguileor2015-04-011-0/+3
| | | | | | | | | Removed duplicate manager.find method call using search argument display_name that affected any command that searches for a volume by display_name or any command that searches for non existent volumes. Change-Id: I86c99b41dd231b058ed3f6d5d78eafe35a111dec Closes-Bug: #1429102
* Move unit tests into test directoryJohn Griffith2015-03-231-0/+186
This is the first step of moving functional testing into the project tree. This change just moves all of the unit tests to be under a dedicated tests/unit directory. Follow up patches will add the functional directory and start moving tempest CLI tests there. Change-Id: I9dc0b8f761676c1b3bbdeb03e2f44b35f75c693e