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.
评论列表
文章目录