

@patch('azurectl.storage.storage.PageBlob')
@patch('azurectl.storage.storage.XZ.uncompressed_size')
@patch('azurectl.storage.storage.XZ.open')
def test_upload(self, mock_xz_open, mock_uncompressed_size, mock_page_blob):
    stream = mock.Mock
    stream.close = mock.Mock()
    mock_xz_open.return_value = stream
    page_blob = mock.Mock()
    next_results = [3, 2, 1]

    def side_effect(stream, max_chunk_size, max_attempts):
        try:
            return next_results.pop()
        except:
            raise StopIteration
    page_blob.next.side_effect = side_effect
    mock_page_blob.return_value = page_blob
    next_results.return_value = 1024
    self.storage.upload('../data/blob.xz')
    assert (page_blob.next.call_args_list == [call(stream, None, 5), call(stream, None, 5), call(stream, None, 5), call(stream, None, 5)])
    stream.close.assert_called_once_with()

dataset/ETHPy150Open SUSE/azurectl/test/unit/storage_storage_test.py TestStorage.test_upload/VarMisuse@122/202 `mock_uncompressed_size`->`next_results`