More passing tests on Python 3.

This commit is contained in:
Itamar Turner-Trauring 2021-01-25 09:25:20 -05:00
parent 4c5ea34af6
commit 3eb62f1d0f
2 changed files with 14 additions and 13 deletions

View File

@ -1644,35 +1644,35 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi
return d
def test_GET_FILEURL_info_mdmf(self):
d = self.GET("/uri/%s?t=info" % self._quux_txt_uri)
d = self.GET("/uri/%s?t=info" % unicode(self._quux_txt_uri, "ascii"))
def _got(res):
self.failUnlessIn("mutable file (mdmf)", res)
self.failUnlessIn(b"mutable file (mdmf)", res)
self.failUnlessIn(self._quux_txt_uri, res)
self.failUnlessIn(self._quux_txt_readonly_uri, res)
d.addCallback(_got)
return d
def test_GET_FILEURL_info_mdmf_readonly(self):
d = self.GET("/uri/%s?t=info" % self._quux_txt_readonly_uri)
d = self.GET("/uri/%s?t=info" % unicode(self._quux_txt_readonly_uri, "ascii"))
def _got(res):
self.failUnlessIn("mutable file (mdmf)", res)
self.failUnlessIn(b"mutable file (mdmf)", res)
self.failIfIn(self._quux_txt_uri, res)
self.failUnlessIn(self._quux_txt_readonly_uri, res)
d.addCallback(_got)
return d
def test_GET_FILEURL_info_sdmf(self):
d = self.GET("/uri/%s?t=info" % self._baz_txt_uri)
d = self.GET("/uri/%s?t=info" % unicode(self._baz_txt_uri, "ascii"))
def _got(res):
self.failUnlessIn("mutable file (sdmf)", res)
self.failUnlessIn(b"mutable file (sdmf)", res)
self.failUnlessIn(self._baz_txt_uri, res)
d.addCallback(_got)
return d
def test_GET_FILEURL_info_mdmf_extensions(self):
d = self.GET("/uri/%s:STUFF?t=info" % self._quux_txt_uri)
d = self.GET("/uri/%s:STUFF?t=info" % unicode(self._quux_txt_uri, "ascii"))
def _got(res):
self.failUnlessIn("mutable file (mdmf)", res)
self.failUnlessIn(b"mutable file (mdmf)", res)
self.failUnlessIn(self._quux_txt_uri, res)
self.failUnlessIn(self._quux_txt_readonly_uri, res)
d.addCallback(_got)

View File

@ -1,5 +1,6 @@
import os, urllib
import os
from urllib.parse import quote as urlquote
from twisted.python.filepath import FilePath
from twisted.web.template import tags as T, Element, renderElement, XMLFile, renderer
@ -180,7 +181,7 @@ class MoreInfoElement(Element):
else:
return ""
root = self.get_root(req)
quoted_uri = urllib.quote(node.get_uri())
quoted_uri = urlquote(node.get_uri())
text_plain_url = "%s/file/%s/@@named=/raw.txt" % (root, quoted_uri)
return T.li("Raw data as ", T.a("text/plain", href=text_plain_url))
@ -196,7 +197,7 @@ class MoreInfoElement(Element):
@renderer
def check_form(self, req, tag):
node = self.original
quoted_uri = urllib.quote(node.get_uri())
quoted_uri = urlquote(node.get_uri())
target = self.get_root(req) + "/uri/" + quoted_uri
if IDirectoryNode.providedBy(node):
target += "/"
@ -236,8 +237,8 @@ class MoreInfoElement(Element):
def overwrite_form(self, req, tag):
node = self.original
root = self.get_root(req)
action = "%s/uri/%s" % (root, urllib.quote(node.get_uri()))
done_url = "%s/uri/%s?t=info" % (root, urllib.quote(node.get_uri()))
action = "%s/uri/%s" % (root, urlquote(node.get_uri()))
done_url = "%s/uri/%s?t=info" % (root, urlquote(node.get_uri()))
overwrite = T.form(action=action, method="post",
enctype="multipart/form-data")(
T.fieldset(