test_rackspace_uploader.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:FRG-Crowdsourcing 作者: 97amarnathk 项目源码 文件源码
def test_rackspace_uploader_lookup_url_enable_cdn(self, mock1, mock2):
        """Test RACKSPACE UPLOADER lookup enables CDN for non enabled CDN."""
        filename = 'test.jpg'
        with patch('pybossa.uploader.rackspace.pyrax.cloudfiles') as mycf:
            cdn_enabled_mock = PropertyMock(return_value=False)
            type(fake_container).cdn_enabled = cdn_enabled_mock
            mycf.get_container.return_value = fake_container

            u = RackspaceUploader()
            u.init_app(self.flask_app)
            res = u._lookup_url('rackspace', {'filename': filename,
                                              'container': 'user_3'})
            url = 'https://rackspace.com/test.jpg'
            err_msg = "We should get the %s but we got %s " % (url, res)
            assert res == url, err_msg
            calls = [call.make_public()]
            fake_container.assert_has_calls(calls, any_order=True)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号