summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTim Burke <tim.burke@gmail.com>2017-03-15 18:05:38 +0000
committerTim Burke <tim.burke@gmail.com>2017-07-11 17:04:49 -0700
commit638d7c789cf3ccab61bf6af6fcab6e6d79b9e0a4 (patch)
tree9574c7dbbbf4f7760e87a48970e5b1823a0ad0c7 /tests
parentcde73c196d4f161b227fb924cd59cf02eaa33c03 (diff)
downloadpython-swiftclient-638d7c789cf3ccab61bf6af6fcab6e6d79b9e0a4.tar.gz
Buffer reads from disk
Otherwise, Python defaults to 8k reads which seems kinda terrible. Change-Id: I3160626e947083af487fd1c3cb0aa6a62646527b Closes-Bug: #1671621
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/test_service.py8
-rw-r--r--tests/unit/test_shell.py12
2 files changed, 10 insertions, 10 deletions
diff --git a/tests/unit/test_service.py b/tests/unit/test_service.py
index 6490b3f..54f0a11 100644
--- a/tests/unit/test_service.py
+++ b/tests/unit/test_service.py
@@ -1951,7 +1951,7 @@ class TestServiceDownload(_TestServiceBase):
'headers_receipt': 3
}
)
- mock_open.assert_called_once_with('test_o', 'wb')
+ mock_open.assert_called_once_with('test_o', 'wb', 65536)
written_content.write.assert_called_once_with(b'objcontent')
mock_conn.get_object.assert_called_once_with(
@@ -1995,7 +1995,7 @@ class TestServiceDownload(_TestServiceBase):
'headers_receipt': 3
}
)
- mock_open.assert_called_once_with('test_o', 'wb')
+ mock_open.assert_called_once_with('test_o', 'wb', 65536)
mock_utime.assert_called_once_with(
'test_o', (1454113727.682512, 1454113727.682512))
written_content.write.assert_called_once_with(b'objcontent')
@@ -2041,7 +2041,7 @@ class TestServiceDownload(_TestServiceBase):
'headers_receipt': 3
}
)
- mock_open.assert_called_once_with('test_o', 'wb')
+ mock_open.assert_called_once_with('test_o', 'wb', 65536)
self.assertEqual(0, len(mock_utime.mock_calls))
written_content.write.assert_called_once_with(b'objcontent')
@@ -2087,7 +2087,7 @@ class TestServiceDownload(_TestServiceBase):
'headers_receipt': 3
}
)
- mock_open.assert_called_once_with('test_o', 'wb')
+ mock_open.assert_called_once_with('test_o', 'wb', 65536)
self.assertEqual([], mock_utime.mock_calls)
written_content.write.assert_called_once_with(b'objcontent')
diff --git a/tests/unit/test_shell.py b/tests/unit/test_shell.py
index db96df7..4c47db1 100644
--- a/tests/unit/test_shell.py
+++ b/tests/unit/test_shell.py
@@ -473,7 +473,7 @@ class TestShell(unittest.TestCase):
response_dict={})]
connection.return_value.get_object.assert_has_calls(
calls, any_order=True)
- mock_open.assert_called_once_with('object', 'wb')
+ mock_open.assert_called_once_with('object', 'wb', 65536)
self.assertEqual([mock.call('pseudo')], makedirs.mock_calls)
makedirs.reset_mock()
@@ -490,7 +490,7 @@ class TestShell(unittest.TestCase):
connection.return_value.get_object.assert_called_with(
'container', 'object', headers={}, resp_chunk_size=65536,
response_dict={})
- mock_open.assert_called_with('object', 'wb')
+ mock_open.assert_called_with('object', 'wb', 65536)
self.assertEqual([], makedirs.mock_calls)
# Test downloading without md5 checks
@@ -507,7 +507,7 @@ class TestShell(unittest.TestCase):
connection.return_value.get_object.assert_called_with(
'container', 'object', headers={}, resp_chunk_size=65536,
response_dict={})
- mock_open.assert_called_with('object', 'wb')
+ mock_open.assert_called_with('object', 'wb', 65536)
sr.assert_called_once_with('object', mock.ANY, mock.ANY, False)
self.assertEqual([], makedirs.mock_calls)
@@ -553,7 +553,7 @@ class TestShell(unittest.TestCase):
mock_shuffle.assert_any_call(['container'])
mock_shuffle.assert_any_call(['object'])
mock_shuffle.assert_any_call(['pseudo/'])
- mock_open.assert_called_once_with('container/object', 'wb')
+ mock_open.assert_called_once_with('container/object', 'wb', 65536)
self.assertEqual([
mock.call('container'),
mock.call('container/pseudo'),
@@ -577,7 +577,7 @@ class TestShell(unittest.TestCase):
argv = ["", "download", "--all", "--no-shuffle"]
swiftclient.shell.main(argv)
self.assertEqual(0, mock_shuffle.call_count)
- mock_open.assert_called_once_with('container/object', 'wb')
+ mock_open.assert_called_once_with('container/object', 'wb', 65536)
self.assertEqual([
mock.call('container'),
mock.call('container/pseudo'),
@@ -610,7 +610,7 @@ class TestShell(unittest.TestCase):
response_dict={})]
connection.return_value.get_object.assert_has_calls(
calls, any_order=True)
- mock_open.assert_called_once_with('object', 'wb')
+ mock_open.assert_called_once_with('object', 'wb', 65536)
self.assertEqual([
mock.call('pseudo'),
], mock_mkdir.mock_calls)