test_combo.py 文件源码

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

项目:maas 作者: maas 项目源码 文件源码
def test_get_combo_redirects_if_unknown_type(self):
        # The optional parameter 'default_redirect' allows to configure
        # a default address where requests for files of unknown types will be
        # redirected.
        # Create a test file with an unknown extension.
        test_file_name = "%s.%s" % (
            factory.make_string(), factory.make_string())
        redirect_root = factory.make_string()
        view = get_combo_view(
            factory.make_string(), default_redirect=redirect_root)
        rf = RequestFactory()
        request = rf.get("/test/?%s" % test_file_name)
        response = view(request)
        self.assertEqual(
            '%s%s' % (redirect_root, test_file_name),
            extract_redirect(response))


# String used by convoy to replace missing files.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号