def test_rackspace_uploader_upload_correct_purgin_first_file(self, mock, mock2):
"""Test RACKSPACE UPLOADER upload file purging first file works."""
with patch('pybossa.uploader.rackspace.pyrax.cloudfiles') as mycf:
mycf.upload_file.return_value=True
mycf.get_object.side_effect = True
u = RackspaceUploader()
u.init_app(self.flask_app)
file = FileStorage(filename='test.jpg')
err_msg = "Upload file should return True"
assert u.upload_file(file, container='user_3') is True, err_msg
calls = [call.get_container('user_3'),
call.get_container().get_object().delete(),
call.get_container().get_object('test.jpg')]
print mycf.mock_calls
mycf.assert_has_calls(calls, any_order=True)
test_rackspace_uploader.py 文件源码
python
阅读 23
收藏 0
点赞 0
评论 0
评论列表
文章目录