From 3e1a457db04697a9ccb4054eeb9f34953dcfca2e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Peter=20Lis=C3=A1k?= <peter.lisak@firma.seznam.cz>
Date: Tue, 3 Nov 2015 16:11:32 +0100
Subject: [PATCH] Add content-type in list of container content

Change-Id: Ie0787d5ffbee0a7d2429cb285fa6ecdf722e4ae1
---
 swiftclient/shell.py     | 4 +++-
 tests/unit/test_shell.py | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/swiftclient/shell.py b/swiftclient/shell.py
index 2d2a7a1f..15ca5706 100755
--- a/swiftclient/shell.py
+++ b/swiftclient/shell.py
@@ -424,6 +424,7 @@ def st_list(parser, args, output_manager):
                             datestamp, item_name)
                 else:    # list container contents
                     subdir = item.get('subdir')
+                    content_type = item.get('content_type')
                     if subdir is None:
                         item_bytes = item.get('bytes')
                         byte_str = prt_bytes(item_bytes, options.human)
@@ -436,7 +437,8 @@ def st_list(parser, args, output_manager):
                         item_name = subdir
                     if not options.totals:
                         output_manager.print_msg(
-                            "%s %10s %8s %s", byte_str, date, xtime, item_name)
+                            "%s %10s %8s %24s %s",
+                            byte_str, date, xtime, content_type, item_name)
                 total_bytes += item_bytes
 
         # report totals
diff --git a/tests/unit/test_shell.py b/tests/unit/test_shell.py
index 835d1d44..cac4da20 100644
--- a/tests/unit/test_shell.py
+++ b/tests/unit/test_shell.py
@@ -293,6 +293,7 @@ class TestShell(testtools.TestCase):
         # Test container listing with --long
         connection.return_value.get_container.side_effect = [
             [None, [{'name': 'object_a', 'bytes': 0,
+                     'content_type': 'type/content',
                      'last_modified': '123T456'}]],
             [None, []],
         ]
@@ -306,7 +307,8 @@ class TestShell(testtools.TestCase):
             connection.return_value.get_container.assert_has_calls(calls)
 
             self.assertEqual(output.out,
-                             '           0        123      456 object_a\n'
+                             '           0        123      456'
+                             '             type/content object_a\n'
                              '           0\n')
 
     @mock.patch('swiftclient.service.makedirs')