def test_rackspace_uploader_init(self, Mock):
"""Test RACKSPACE UPLOADER init works."""
new_extensions = ['pdf', 'doe']
with patch('pybossa.uploader.rackspace.pyrax.cloudfiles',
return_value=cloudfiles_mock):
with patch.dict(self.flask_app.config,
{'ALLOWED_EXTENSIONS': new_extensions}):
with patch('pybossa.uploader.rackspace.pyrax.cloudfiles') as mycf:
mycf.get_container.return_value = True
u = RackspaceUploader()
res = u.init_app(self.flask_app, cont_name='mycontainer')
err_msg = "It should return the container."
assert res is True, err_msg
err_msg = "The container name should be updated."
assert u.cont_name == 'mycontainer', err_msg
for ext in new_extensions:
err_msg = "The .%s extension should be allowed" % ext
assert ext in u.allowed_extensions, err_msg
test_rackspace_uploader.py 文件源码
python
阅读 29
收藏 0
点赞 0
评论 0
评论列表
文章目录