Commit a0608786 authored by Stavros Sachtouris's avatar Stavros Sachtouris
Browse files

Fix spelling mistake (ident-->indent)

parent f55d3a15
......@@ -40,7 +40,7 @@ from json import dumps
from kamaki.cli.errors import raiseCLIError
IDENT_TAB = 4
INDENT_TAB = 4
suggest = dict(ansicolors=dict(
......@@ -113,7 +113,7 @@ def print_json(data):
:param data: json-dumpable data
"""
print(dumps(data, indent=IDENT_TAB))
print(dumps(data, indent=INDENT_TAB))
def pretty_dict(d, *args, **kwargs):
......@@ -127,7 +127,7 @@ def print_dict(
"""Pretty-print a dictionary object
<indent>key: <non iterable item>
<indent>key:
<indent + IDENT_TAB><pretty-print iterable>
<indent + INDENT_TAB><pretty-print iterable>
:param d: (dict)
......@@ -155,12 +155,12 @@ def print_dict(
if isinstance(v, dict):
print print_str
print_dict(
v, exclude, indent + IDENT_TAB,
v, exclude, indent + INDENT_TAB,
recursive_enumeration, recursive_enumeration)
elif isinstance(v, list) or isinstance(v, tuple):
print print_str
print_list(
v, exclude, indent + IDENT_TAB,
v, exclude, indent + INDENT_TAB,
recursive_enumeration, recursive_enumeration)
else:
print '%s %s' % (print_str, v)
......@@ -173,7 +173,7 @@ def print_list(
"""Pretty-print a list of items
<indent>key: <non iterable item>
<indent>key:
<indent + IDENT_TAB><pretty-print iterable>
<indent + INDENT_TAB><pretty-print iterable>
:param l: (list)
......@@ -192,28 +192,33 @@ def print_list(
'print_list prinbts a list or tuple')
assert indent >= 0, 'print_list indent must be >= 0'
counter = 0
for i, item in enumerate(l):
print_str = ' ' * indent
print_str += '%s.' % (i + 1) if with_enumeration else ''
if isinstance(item, dict):
if with_enumeration:
print print_str
elif counter and counter < len(l):
print
print_dict(
item, exclude, indent,
item, exclude,
indent + (INDENT_TAB if with_enumeration else 0),
recursive_enumeration, recursive_enumeration)
elif isinstance(item, list) or isinstance(item, tuple):
if with_enumeration:
print print_str
elif counter and counter < len(l):
print
print_list(
item, exclude, indent + IDENT_TAB,
item, exclude, indent + INDENT_TAB,
recursive_enumeration, recursive_enumeration)
else:
item = ('%s' % item).strip()
if item in exclude:
continue
print '%s%s' % (print_str, item)
if (i + 1) < len(l):
print
counter += 1
def page_hold(index, limit, maxlen):
......@@ -274,9 +279,9 @@ def print_items(
header = ' '.join('%s' % item.pop(key) for key in title)
print(bold(header))
if isinstance(item, dict):
print_dict(item, indent=IDENT_TAB)
print_dict(item, indent=INDENT_TAB)
elif isinstance(item, list):
print_list(item, indent=IDENT_TAB)
print_list(item, indent=INDENT_TAB)
else:
print(' %s' % item)
page_hold(i + 1, page_size, len(items))
......
......@@ -428,18 +428,18 @@ class Cyclades(livetest.Generic):
r = self.client.get_flavor_details(self.flavorid)
self.assert_dicts_are_equal(self._flavor_details, r)
#def test_list_images(self):
# """Test list_images"""
# self._test_0140_list_images()
#def _test_0140_list_images(self):
# r = self.client.list_images()
# self.assertTrue(len(r) > 1)
# r = self.client.list_images(detail=True)
# for detailed_img in r:
# if detailed_img['id'] == self.img:
# break
# self.assert_dicts_are_equal(detailed_img, self.img_details)
def test_list_images(self):
"""Test list_images"""
self._test_0140_list_images()
def _test_0140_list_images(self):
r = self.client.list_images()
self.assertTrue(len(r) > 1)
r = self.client.list_images(detail=True)
for detailed_img in r:
if detailed_img['id'] == self.img:
break
self.assert_dicts_are_equal(detailed_img, self.img_details)
def test_get_image_details(self):
"""Test image_details"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment