Merge "Include storage policy when listing account with --long"
This commit is contained in:
commit
3f5d5b0252
@ -549,10 +549,11 @@ def st_list(parser, args, output_manager, return_parser=False):
|
|||||||
datestamp = strftime('%Y-%m-%d %H:%M:%S', utc)
|
datestamp = strftime('%Y-%m-%d %H:%M:%S', utc)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
datestamp = '????-??-?? ??:??:??'
|
datestamp = '????-??-?? ??:??:??'
|
||||||
|
storage_policy = meta.get('x-storage-policy', '???')
|
||||||
if not options['totals']:
|
if not options['totals']:
|
||||||
output_manager.print_msg(
|
output_manager.print_msg(
|
||||||
"%12s %s %s %s", count, byte_str,
|
"%12s %s %s %-15s %s", count, byte_str,
|
||||||
datestamp, item_name)
|
datestamp, storage_policy, item_name)
|
||||||
else: # list container contents
|
else: # list container contents
|
||||||
subdir = item.get('subdir')
|
subdir = item.get('subdir')
|
||||||
content_type = item.get('content_type')
|
content_type = item.get('content_type')
|
||||||
|
@ -466,6 +466,10 @@ class TestShell(unittest.TestCase):
|
|||||||
[None, [{'name': 'container', 'bytes': 0, 'count': 0}]],
|
[None, [{'name': 'container', 'bytes': 0, 'count': 0}]],
|
||||||
[None, []],
|
[None, []],
|
||||||
]
|
]
|
||||||
|
connection.return_value.head_container.return_value = {
|
||||||
|
'x-timestamp': '1617393213.49752',
|
||||||
|
'x-storage-policy': 'some-policy',
|
||||||
|
}
|
||||||
|
|
||||||
argv = ["", "list", "--lh"]
|
argv = ["", "list", "--lh"]
|
||||||
with CaptureOutput() as output:
|
with CaptureOutput() as output:
|
||||||
@ -474,10 +478,10 @@ class TestShell(unittest.TestCase):
|
|||||||
mock.call(marker='container', prefix=None, headers={})]
|
mock.call(marker='container', prefix=None, headers={})]
|
||||||
connection.return_value.get_account.assert_has_calls(calls)
|
connection.return_value.get_account.assert_has_calls(calls)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
output.out,
|
output.out,
|
||||||
' 0 0 1970-01-01 00:00:01 container\n'
|
' 0 0 2021-04-02 19:53:33 some-policy container\n'
|
||||||
' 0 0\n')
|
' 0 0\n')
|
||||||
|
|
||||||
# Now test again, this time without returning metadata
|
# Now test again, this time without returning metadata
|
||||||
connection.return_value.head_container.return_value = {}
|
connection.return_value.head_container.return_value = {}
|
||||||
@ -495,10 +499,10 @@ class TestShell(unittest.TestCase):
|
|||||||
mock.call(marker='container', prefix=None, headers={})]
|
mock.call(marker='container', prefix=None, headers={})]
|
||||||
connection.return_value.get_account.assert_has_calls(calls)
|
connection.return_value.get_account.assert_has_calls(calls)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
output.out,
|
output.out,
|
||||||
' 0 0 ????-??-?? ??:??:?? container\n'
|
' 0 0 ????-??-?? ??:??:?? ??? container\n'
|
||||||
' 0 0\n')
|
' 0 0\n')
|
||||||
|
|
||||||
def test_list_account_totals_error(self):
|
def test_list_account_totals_error(self):
|
||||||
# No --lh provided: expect info message about incorrect --totals use
|
# No --lh provided: expect info message about incorrect --totals use
|
||||||
|
Loading…
Reference in New Issue
Block a user