Skip to content

Commit

Permalink
Merge pull request #3412 from ryansb/develop
Browse files Browse the repository at this point in the history
Fix Glacier test failure in python 3.5 due to MagicMock
  • Loading branch information
jamesls committed Dec 22, 2015
2 parents 607cad7 + 53be601 commit d042f07
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/unit/glacier/test_concurrent.py
Expand Up @@ -95,14 +95,20 @@ def test_work_queue_is_correctly_populated(self):


def test_correct_low_level_api_calls(self): def test_correct_low_level_api_calls(self):
api_mock = mock.MagicMock() api_mock = mock.MagicMock()
upload_id = '0898d645-ea45-4548-9a67-578f507ead49'
initiate_upload_mock = mock.Mock(
return_value={'UploadId': upload_id})
# initiate_multipart_upload must return a body containing an `UploadId`
api_mock.attach_mock(initiate_upload_mock, 'initiate_multipart_upload')

uploader = FakeThreadedConcurrentUploader(api_mock, 'vault_name') uploader = FakeThreadedConcurrentUploader(api_mock, 'vault_name')
uploader.upload('foofile') uploader.upload('foofile')
# The threads call the upload_part, so we're just verifying the # The threads call the upload_part, so we're just verifying the
# initiate/complete multipart API calls. # initiate/complete multipart API calls.
api_mock.initiate_multipart_upload.assert_called_with( initiate_upload_mock.assert_called_with(
'vault_name', 4 * 1024 * 1024, None) 'vault_name', 4 * 1024 * 1024, None)
api_mock.complete_multipart_upload.assert_called_with( api_mock.complete_multipart_upload.assert_called_with(
'vault_name', mock.ANY, mock.ANY, 8 * 1024 * 1024) 'vault_name', upload_id, mock.ANY, 8 * 1024 * 1024)


def test_downloader_work_queue_is_correctly_populated(self): def test_downloader_work_queue_is_correctly_populated(self):
job = mock.MagicMock() job = mock.MagicMock()
Expand Down

0 comments on commit d042f07

Please sign in to comment.