summaryrefslogtreecommitdiff
path: root/cinderclient/tests/unit/test_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'cinderclient/tests/unit/test_utils.py')
-rw-r--r--cinderclient/tests/unit/test_utils.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/cinderclient/tests/unit/test_utils.py b/cinderclient/tests/unit/test_utils.py
index a62425e..eeb4800 100644
--- a/cinderclient/tests/unit/test_utils.py
+++ b/cinderclient/tests/unit/test_utils.py
@@ -12,6 +12,7 @@
# limitations under the License.
import collections
+import ddt
import sys
import mock
@@ -21,6 +22,7 @@ import six
from cinderclient import api_versions
from cinderclient.apiclient import base as common_base
from cinderclient import exceptions
+from cinderclient import shell_utils
from cinderclient import utils
from cinderclient import base
from cinderclient.tests.unit import utils as test_utils
@@ -187,6 +189,21 @@ class BuildQueryParamTestCase(test_utils.TestCase):
self.assertFalse(result_2)
+@ddt.ddt
+class ExtractFilterTestCase(test_utils.TestCase):
+
+ @ddt.data({'content': ['key1=value1'],
+ 'expected': {'key1': 'value1'}},
+ {'content': ['key1={key2:value2}'],
+ 'expected': {'key1': {'key2': 'value2'}}},
+ {'content': ['key1=value1', 'key2={key22:value22}'],
+ 'expected': {'key1': 'value1', 'key2': {'key22': 'value22'}}})
+ @ddt.unpack
+ def test_extract_filters(self, content, expected):
+ result = shell_utils.extract_filters(content)
+ self.assertEqual(expected, result)
+
+
class PrintListTestCase(test_utils.TestCase):
def test_print_list_with_list(self):