Commit Graph

5 Commits

Author SHA1 Message Date
Stephen Finucane 35ba1d8f13 Blacken openstackclient.volume
Black used with the '-l 79 -S' flags.

A future change will ignore this commit in git-blame history by adding a
'git-blame-ignore-revs' file.

Change-Id: Ic318617c67ab7ce6527f9016b759a1d4b0b80802
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2023-05-10 10:51:30 +01:00
Sean McGinnis 69db9fe73c
Raise flake8-import-order version to latest
We had this library capped at a release that is a few years old. Now
that we have dropped py2 testing, we can pick up the latest version.

This uncovered a few things to clean up. Mostly the fact that mock is
now a part of the StdLib unittest since Python 3.3.

Change-Id: I27484dd4c25378413ff16e97a35a1a46062357bc
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2020-01-10 14:21:47 -06:00
Sean McGinnis 651f0c38a1
Handle not having cinderclient.v1 available
The Cinder v1 API was deprecated several years ago and may be removed
from python-cinderclient in the near future. To handle the case where v1
is no longer present, this updates cinderclient initialization to work
without it and give an appropriate error if v1 is requested with a
version where it is no longer available.

Change-Id: I277d7b48b8ad4cce383ec3722f8117938378f615
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2018-10-12 14:19:51 -05:00
Akihiro Motoki 3cba09e767 Fix unit test failures related to new os-client-config and osc-lib
[breakage related to os-client-config 1.28.0]
os-client-config 1.28.0 add a check if filebased and envvars are
both used. This check causes OSC unit test failure.

OSC now instantiates OpenStackConfig twice as a workaround.
The unit test mocks _load_config_file() and it returns a config dict,
but os-client-config OpenStackConfig.__init__ updates the dict returned.
As a result, when OpenStackConfig is instantiated second time,
the mock of _load_config_file returns a modified version of the config
dict. This hits the new check in os-client-config 1.28.0.

This commit changes the mock to use side_effect rather than return_value
to ensure the original dict is used.

[breakage related to osc-lib 1.7.0]
The change in osc-lib 1.7.0 added "if" logic to avoid calling get() twice.
In tests.unit.volume.test_find_resource, kwargs is empty dict in find_resource(),
so the second call to get() is NOT called now.
Removing the second elements of side_effect addresses the unit failure.

Co-Authored-By: Rui Chen <chenrui.momo@gmail.com>
Change-Id: Ib9d14661b2755bbd6619e15c0d9023fbc9d27d70
Closes-Bug: #1703782
Closes-Bug: #1703783
2017-07-12 12:26:00 +00:00
Steve Martinelli 39839def2e move unit tests to new "unit" test module
this will better isolate the unit tests from the functional tests.
unfortunately, the "integration" tests had to be lumped into the
"unit" tests since we need the separation in testr.conf

Change-Id: Ifd12198c1f90e4e3c951c73bfa1884ab300d8ded
2016-09-08 15:19:50 -07:00