Repository: softlayer/softlayer-python

Issue:
Rich table doesn't work for item-list
```
$ slcli order item-list STORAGE_AS_A_SERVICE_STAAS
CASTSDFSDFSDFSDFSDF
<rich.table.Table object at 0x0000023B30C75810>
```

Discussion:

Patch:
diff --git a/SoftLayer/CLI/order/item_list.py b/SoftLayer/CLI/order/item_list.py
index eef805d2..173e30a2 100644
--- a/SoftLayer/CLI/order/item_list.py
+++ b/SoftLayer/CLI/order/item_list.py
@@ -8,18 +8,19 @@
 from SoftLayer.managers import ordering
 from SoftLayer.utils import lookup
 
-COLUMNS = ['category', 'keyName', 'description', 'priceId']
-COLUMNS_ITEM_PRICES = ['keyName', 'priceId', 'Hourly', 'Monthly', 'Restriction']
-COLUMNS_ITEM_PRICES_LOCATION = ['keyName', 'priceId', 'Hourly', 'Monthly', 'Restriction']
+COLUMNS = ['Category', 'KeyName', 'Description', 'Price Id']
+COLUMNS_ITEM_PRICES = ['KeyName', 'Price Id', 'Hourly', 'Monthly', 'Restriction']
+COLUMNS_ITEM_PRICES_LOCATION = ['KeyName', 'Price Id', 'Hourly', 'Monthly', 'Restriction']
 
 
 @click.command(cls=SLCommand)
 @click.argument('package_keyname')
 @click.option('--keyword', '-k', help="A word (or string) used to filter item names.")
 @click.option('--category', '-c', help="Category code to filter items by")
-@click.option('--prices', '-p', is_flag=True, help='Use --prices to list the server item prices, and to list the '
-                                                   'Item Prices by location, add it to the --prices option using '
-                                                   'location KeyName, e.g. --prices AMSTERDAM02')
+@click.option('--prices', '-p', is_flag=True,
+              help='Use --prices to list the server item prices, and to list the '
+                   'Item Prices by location, add it to the --prices option using '
+                   'location KeyName, e.g. --prices AMSTERDAM02')
 @click.argument('location', required=False)
 @environment.pass_env
 def cli(env, package_keyname, keyword, category, prices, location=None):
@@ -66,7 +67,7 @@ def cli(env, package_keyname, keyword, category, prices, location=None):
             for item in sorted_items[category_name]:
                 table_items_detail.add_row([category_name, item['keyName'], item['description'], get_price(item)])
         tables.append(table_items_detail)
-    env.fout(formatting.listing(tables, separator='\n'))
+    env.fout(tables)
 
 
 def sort_items(items):


Test patch:
diff --git a/tests/CLI/modules/order_tests.py b/tests/CLI/modules/order_tests.py
index d493b67f..c1541594 100644
--- a/tests/CLI/modules/order_tests.py
+++ b/tests/CLI/modules/order_tests.py
@@ -50,9 +50,9 @@ def test_item_list_prices(self):
 
         self.assert_no_fail(result)
         output = json.loads(result.output)
-        self.assertEqual(output[0][0]['priceId'], 1007)
+        self.assertEqual(output[0][0]['Price Id'], 1007)
         self.assertEqual(output[0][1]['Restriction'], '- - - -')
-        self.assertEqual(output[0][1]['keyName'], 'KeyName015')
+        self.assertEqual(output[0][1]['KeyName'], 'KeyName015')
         self.assert_called_with('SoftLayer_Product_Package', 'getItems')
 
     def test_item_list_location_keyname(self):
@@ -61,8 +61,8 @@ def test_item_list_location_keyname(self):
         self.assert_no_fail(result)
         output = json.loads(result.output)
         self.assertEqual(output[0][0]['Hourly'], 0.0)
-        self.assertEqual(output[0][1]['keyName'], 'KeyName015')
-        self.assertEqual(output[0][1]['priceId'], 1144)
+        self.assertEqual(output[0][1]['KeyName'], 'KeyName015')
+        self.assertEqual(output[0][1]['Price Id'], 1144)
         self.assert_called_with('SoftLayer_Product_Package', 'getItemPrices')
 
     def test_item_list_location_name(self):
@@ -71,8 +71,8 @@ def test_item_list_location_name(self):
         self.assert_no_fail(result)
         output = json.loads(result.output)
         self.assertEqual(output[0][0]['Hourly'], 0.0)
-        self.assertEqual(output[0][1]['keyName'], 'KeyName015')
-        self.assertEqual(output[0][1]['priceId'], 1144)
+        self.assertEqual(output[0][1]['KeyName'], 'KeyName015')
+        self.assertEqual(output[0][1]['Price Id'], 1144)
         self.assert_called_with('SoftLayer_Product_Package', 'getItemPrices')
 
     def test_item_list_category_keyword(self):
@@ -81,8 +81,8 @@ def test_item_list_category_keyword(self):
         self.assert_no_fail(result)
         output = json.loads(result.output)
         self.assertEqual(output[0][0]['Hourly'], 0.0)
-        self.assertEqual(output[0][1]['keyName'], 'KeyName015')
-        self.assertEqual(output[0][1]['priceId'], 1144)
+        self.assertEqual(output[0][1]['KeyName'], 'KeyName015')
+        self.assertEqual(output[0][1]['Price Id'], 1144)
         self.assert_called_with('SoftLayer_Product_Package', 'getItemPrices')
 
     def test_package_list(self):