summaryrefslogtreecommitdiff
path: root/cinderclient/tests/unit/test_base.py
Commit message (Collapse)AuthorAgeFilesLines
* 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-0/+31
| | | | | | | | | | | | | | 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>
* Fix adding non-ascii attrs to Resource objects errorMichael Dovgal2017-01-201-0/+10
| | | | | | | | | | | | | | | | | | | Due to these lines of code [0] we don't have an opportunity to add attributes with non-ascii symbols to Resource objects, but information about it will be in _info dict. Example of side effect - quota_show command. Because we don't have such an attr, here [1] it will be added None value instead of real value [2]. This patch fixes this problem. [0] - https://github.com/openstack/python-cinderclient/blob/f8c93ed03b388612ca28b8055debf915ce631cec/cinderclient/apiclient/base.py#L498-L499 [1] - https://github.com/openstack/python-cinderclient/blob/f8c93ed03b388612ca28b8055debf915ce631cec/cinderclient/shell_utils.py#L179 [2] - http://paste.openstack.org/show/593358/ Change-Id: I0493845dafc5dad836e899b9c22d563023c1dab0 Closes-Bug: #1652605
* Add convertation of query parameters to stringMykhailo Dovgal2016-12-301-1/+18
| | | | | | | | | | | | | There are some problems with non-ascii chars and special symbols during using cinderclient. This patch closes bug connected with parse.urlencode py27 unicode encode bug by adding convertation of query parameters before creating query string in manager._build_list_url method. Also it fix the problems with encoding in quota commands. Change-Id: I96269cca7ad203eaad02d87b30c16d970b26b25f Closes-Bug: #1636621 Closes-Bug: #1518141
* 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
* Deleting volume metadata keys with a single request1.9.0Yuriy Nesenenko2016-09-011-0/+2
| | | | | | | | | | | | | | | | Deleting multiple volume metadata keys with a single request to improve performance. To delete multiple metadata items without affecting the remaining ones, just update the metadata items with the updated complete list of ones (without items to delete) in the body of the request. This patch uses etags to avoid the lost update problem with volume metadata. The command isn't changed: $ cinder metadata volume_id unset k1 k2 k3 Co-Authored-By: Ivan Kolodyazhny <e0ne@e0ne.info> Depends-On: I575635258c10f299181b8e4cdb51a7ad1f1be764 Implements: blueprint delete-multiple-metadata-keys Change-Id: I8e18133ffee87c240a7af4b8177683ab99330d9e
* Make Resource class's function can be wraped by api_versionCao Shufeng2016-09-011-0/+10
| | | | | | | | | | | | api_verson.wraps() function requires the object to have an api_version attribute[1]. This change add api_version attribute to Resource class, so that we can use api_version to wrap functions in Resource class. [1]: https://github.com/openstack/python-cinderclient/blob/master/cinderclient/api_versions.py#L346 Partial-Bug: #1619105 Change-Id: I0fce855768a4a5165ce08274214d4907b4d2fb66
* base.Resource not define __ne__() built-in functionyuyafei2016-07-041-1/+1
| | | | | | | | | | | Class base.Resource defines __eq__() built-in function, but does not define __ne__() built-in function, so self.assertEqual works but self.assertNotEqual does not work at all in this test case in python2. This patch fixes it by defining __ne__() built-in function of class base.Resource. Also fixes spelling errors:resoruces. Change-Id: I845d531880ad74d928a3e15335ed10e71590826e Closes-Bug: #1586268
* Fix Resource.__eq__ mismatch semantics of object equalRui Chen2016-03-011-1/+6
| | | | | | | | | | | | The __eq__ of apiclient.base.Resource will return True, if the two objects have same id, even if they have different other attributes value. The behavior is weird and don't match the semantics of object equal. The objects that have different value should be different objects. Fix this issue and add some test cases in this patch. Change-Id: I187032e5630ac47a4f54db5058dbf9b6e15eba6d Closes-Bug: #1499369
* Provide consistency for Wrapper classesAnkit Agrawal2016-02-151-2/+2
| | | | | | | | | | | | | | Updated TupleWithMeta class to make it consistent with other Meta classes in order to avoid confusion. Also made provision to call TupleWithMeta with a tuple containing one or more elements. For more details on how request_id will be returned to the caller, please refer to the approved blueprint [1] discussed with the cross-project team. [1] http://specs.openstack.org/openstack/openstack-specs/specs/return-request-id.html Change-Id: I5a79a4ed8cb4dc83ea3b64499df191750462100d Partial-Implements: blueprint return-request-id-to-caller
* Add Wrapper classes for list, dict, tupleAnkit Agrawal2016-01-241-0/+48
| | | | | | | | | | | | | Added wrapper classes which are inherited from base data types list, tuple and dict. Each of these wrapper classes contains a 'request_ids' attribute which will be populated with a 'x-openstack-request_id' received in a header from a response body. This change is required to return 'request_id' from client to log request_id mappings of cross projects. Partial-Implements: blueprint return-request-id-to-caller Change-Id: I3aadb4d8bf675e20f2094b66a23ac20f455a99eb
* Add to_dict method to Resource classwanghao2015-12-141-0/+4
| | | | | | | | | | | | | | | | | | | Many clients have to_dict method in Resource class. It is needed to get full info about resource. So it would be nice to add to_dict method in cinder client too. Now openstack/common has graduated from oslo-incubator. So we just modify it cinderclient. Changes merged with this patch: --------------------- apiclient/base.py ---add to_dict function in class Resource. unit/test_base.py ---add unit test case. change-Id: I81add424bcdd667ba271adb7d5b1ceb504120f93
* Move unit tests into test directoryJohn Griffith2015-03-231-0/+61
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