summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTim Burke <tim.burke@gmail.com>2021-09-21 16:02:47 -0700
committerTim Burke <tim.burke@gmail.com>2021-09-21 16:06:56 -0700
commit373fa26ce1620d096918bd34ea4983b8ca96898c (patch)
tree6a04dd1f0f0607c8897e517050c29d544cd2b5af /test
parent5129b33505691f5c4a3e33f2878b157cbd5b4a62 (diff)
downloadpython-swiftclient-373fa26ce1620d096918bd34ea4983b8ca96898c.tar.gz
Correctly aggregate totals for >10k items
Previously, we would write out totals for every page of listings, like $ swift list sync --prefix=09-21 --total -l 80000000000 80000000000 80000000000 58096000000 Now, roll those all into a single total: $ swift list sync --prefix=09-21 --total -l 298096000000 Change-Id: Icc265636815220e33e8c9eec0a3ab80e9f899038
Diffstat (limited to 'test')
-rw-r--r--test/unit/test_shell.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/test/unit/test_shell.py b/test/unit/test_shell.py
index 84dd681..84793ae 100644
--- a/test/unit/test_shell.py
+++ b/test/unit/test_shell.py
@@ -547,9 +547,12 @@ class TestShell(unittest.TestCase):
self.assertEqual(output.out, 'object_a\n')
- # Test container listing with --long
+ # Test container listing with --long and multiple pages
connection.return_value.get_container.side_effect = [
- [None, [{'name': 'object_a', 'bytes': 0,
+ [None, [{'name': 'object_a', 'bytes': 3,
+ 'content_type': 'type/content',
+ 'last_modified': '123T456'}]],
+ [None, [{'name': 'object_b', 'bytes': 5,
'content_type': 'type/content',
'last_modified': '123T456'}]],
[None, []],
@@ -567,9 +570,11 @@ class TestShell(unittest.TestCase):
connection.return_value.get_container.assert_has_calls(calls)
self.assertEqual(output.out,
- ' 0 123 456'
+ ' 3 123 456'
' type/content object_a\n'
- ' 0\n')
+ ' 5 123 456'
+ ' type/content object_b\n'
+ ' 8\n')
@mock.patch('swiftclient.service.Connection')
def test_list_container_with_headers(self, connection):