diff options
| author | TerryHowe <terrylhowe@gmail.com> | 2015-03-04 10:14:40 -0700 |
|---|---|---|
| committer | TerryHowe <terrylhowe@gmail.com> | 2015-03-04 10:14:40 -0700 |
| commit | d05b5e14f13244e269c2bbaa9db6395e37af2b8a (patch) | |
| tree | d2f479ec40102bc67a12723d0529b0d285503143 /openstackclient | |
| parent | 5d92fc0d0a7c606fdcf7a3565801ae361389d9ab (diff) | |
| download | python-openstackclient-d05b5e14f13244e269c2bbaa9db6395e37af2b8a.tar.gz | |
Fix identity v2 catalog list
The v2 catalog list was only printing the last endpoint in
the catalog.
Change-Id: I5401a11eedb3be1513c86261329de50c8ad82720
Diffstat (limited to 'openstackclient')
| -rw-r--r-- | openstackclient/identity/v2_0/catalog.py | 3 | ||||
| -rw-r--r-- | openstackclient/tests/identity/v2_0/test_catalog.py | 35 |
2 files changed, 26 insertions, 12 deletions
diff --git a/openstackclient/identity/v2_0/catalog.py b/openstackclient/identity/v2_0/catalog.py index f6048378..363d5ab2 100644 --- a/openstackclient/identity/v2_0/catalog.py +++ b/openstackclient/identity/v2_0/catalog.py @@ -26,8 +26,9 @@ from openstackclient.i18n import _ # noqa def _format_endpoints(eps=None): if not eps: return "" + ret = '' for index, ep in enumerate(eps): - ret = eps[index]['region'] + '\n' + ret += eps[index]['region'] + '\n' for url in ['publicURL', 'internalURL', 'adminURL']: ret += " %s: %s\n" % (url, eps[index]['publicURL']) return ret diff --git a/openstackclient/tests/identity/v2_0/test_catalog.py b/openstackclient/tests/identity/v2_0/test_catalog.py index 5289cac4..50445954 100644 --- a/openstackclient/tests/identity/v2_0/test_catalog.py +++ b/openstackclient/tests/identity/v2_0/test_catalog.py @@ -23,11 +23,18 @@ class TestCatalog(utils.TestCommand): 'id': 'qwertyuiop', 'type': 'compute', 'name': 'supernova', - 'endpoints': [{ - 'region': 'onlyone', - 'publicURL': 'https://public.example.com', - 'adminURL': 'https://admin.example.com', - }], + 'endpoints': [ + { + 'region': 'one', + 'publicURL': 'https://public.one.example.com', + 'adminURL': 'https://admin.one.example.com', + }, + { + 'region': 'two', + 'publicURL': 'https://public.two.example.com', + 'adminURL': 'https://admin.two.example.com', + }, + ], } def setUp(self): @@ -66,9 +73,12 @@ class TestCatalogList(TestCatalog): datalist = (( 'supernova', 'compute', - 'onlyone\n publicURL: https://public.example.com\n ' - 'internalURL: https://public.example.com\n ' - 'adminURL: https://public.example.com\n', + 'one\n publicURL: https://public.one.example.com\n ' + 'internalURL: https://public.one.example.com\n ' + 'adminURL: https://public.one.example.com\n' + 'two\n publicURL: https://public.two.example.com\n ' + 'internalURL: https://public.two.example.com\n ' + 'adminURL: https://public.two.example.com\n', ), ) self.assertEqual(datalist, tuple(data)) @@ -97,9 +107,12 @@ class TestCatalogShow(TestCatalog): collist = ('endpoints', 'id', 'name', 'type') self.assertEqual(collist, columns) datalist = ( - 'onlyone\n publicURL: https://public.example.com\n ' - 'internalURL: https://public.example.com\n ' - 'adminURL: https://public.example.com\n', + 'one\n publicURL: https://public.one.example.com\n ' + 'internalURL: https://public.one.example.com\n ' + 'adminURL: https://public.one.example.com\n' + 'two\n publicURL: https://public.two.example.com\n ' + 'internalURL: https://public.two.example.com\n ' + 'adminURL: https://public.two.example.com\n', 'qwertyuiop', 'supernova', 'compute', |
