7 Commits

Author SHA1 Message Date
Alfredo Moralejo
32742e784a Replace assertItemsEqual with assertCountEqual
assertItemsEqual was removed from Python's unittest.TestCase in
Python 3.3 [1][2]. We have been able to use them since then, because
testtools required unittest2, which still included it. With testtools
removing Python 2.7 support [3][4], we will lose support for
assertItemsEqual, so we should switch to use assertCountEqual.

[1] - https://bugs.python.org/issue17866
[2] - https://hg.python.org/cpython/rev/d9921cb6e3cd
[3] - testing-cabal/testtools#286
[4] - testing-cabal/testtools#277

Change-Id: I631fb791ece68aac607aeae56ce96a0d472964c8
2020-03-13 14:55:29 +00:00
Stephen Finucane
1420035836 Add KeyValueAppendAction to osc-lib
This is required to support things like the '--hint' option for
'openstack server create', which allows you to specify arguments
multiple times.

Change-Id: If73cab759fa09bddf1ff519923c5972c3b2052b1
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2019-09-27 15:11:18 +01:00
Reedip
4d8fbe6949 Add MultiKeyValueCommaAction to osc-lib
Based on [1], the following class is transitioned to
osc-lib as it may be required in other scenarios as well.
[1]:https://review.openstack.org/#/c/356263/13

* Tests rewritten to be more straightforward in checking combinations
  and expected results.

Change-Id: I293b5b25adcf8ed6815608db4f280ee4e3da5da9
2017-04-18 21:46:38 -05:00
qtang
7dbc92b521 Prevent null key setting for property
null key is the invalid input when setting property
in the openstack components.

Prevent null key setting for property in
openstackclient.

Change-Id: I8ec72664b5393ffef71fffa4bd1cd3c303e86a52
Related-Bug: #1558690
2016-08-04 21:59:34 +00:00
Tang Chen
85c977ac7a Use assertEqual() instead of assertDictEqual()
In unittest2, assertDictEqual() is implemented by
using != operator to compare two dicts. So is
assertEqual() in testtools. assertEqual() in
testtools is able to handle dict, list, set and so
on. So we just call assertEqual() to make the unit
tests simpler.

Change-Id: I5eeeebced716f2065e81d72a9972392ae3a45d89
2016-07-25 15:40:54 +08:00
Huanxuan Ao
876d81ef21 Error handling for KeyValueAction class.
The set --property command requires that the input match
the "key=value" type, but if the type don't match, the return
value will be None, and the command still can be implemented
successfully, this may confuse the users. I think we should
raise exception if the argument type don't match "key=value".
So I make some changes in KeyValueAction class in this patch.

Change-Id: If4a00ae6da08bc12362ef2fc82012b42839141f0
2016-06-08 11:41:02 +08:00
Dean Troyer
2bcf7396d8 Begin moving bits to osc_lib
* command
* commandmanager
* exceptions
* logs
* parseractions
* session
* timing
* utils
* test fakes, utils
2016-05-12 16:07:24 -05:00