beautifulsoup, not re
This commit is contained in:
parent
7c27f295a9
commit
d5ef65d326
|
@ -4177,15 +4177,31 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi
|
||||||
self.GET, "/uri")
|
self.GET, "/uri")
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
@inlineCallbacks
|
||||||
def test_GET_rename_form(self):
|
def test_GET_rename_form(self):
|
||||||
d = self.GET(self.public_url + "/foo?t=rename-form&name=bar.txt",
|
data = yield self.GET(
|
||||||
followRedirect=True)
|
self.public_url + "/foo?t=rename-form&name=bar.txt",
|
||||||
def _check(res):
|
followRedirect=True
|
||||||
self.failUnless(re.search('<input (name="when_done" |value="." |type="hidden" ){3}/>', res), res)
|
)
|
||||||
self.failUnless(re.search(r'<input (readonly="true" |type="text" |name="from_name" |value="bar\.txt" ){4}/>', res), res)
|
soup = BeautifulSoup(data, 'html5lib')
|
||||||
self.failUnlessIn(FAVICON_MARKUP, res)
|
assert_soup_has_favicon(self, soup)
|
||||||
d.addCallback(_check)
|
inputs = soup.find_all(u"input")
|
||||||
return d
|
want = [
|
||||||
|
{u"name": u"when_done", u"value": u".", u"type": u"hidden"},
|
||||||
|
{u"readonly": u"true", u"name": u"from_name", u"value": u"bar.txt", u"type": u"text"},
|
||||||
|
]
|
||||||
|
found = []
|
||||||
|
for inp in inputs:
|
||||||
|
print(inp)
|
||||||
|
print(dir(inp))
|
||||||
|
print(inp.attrs)
|
||||||
|
if inp.attrs in want:
|
||||||
|
found.append(inp.attrs)
|
||||||
|
self.assertEqual(
|
||||||
|
len(found),
|
||||||
|
len(want),
|
||||||
|
"Wanted <input> tags: {} but only found: {}".format(want, found),
|
||||||
|
)
|
||||||
|
|
||||||
def log(self, res, msg):
|
def log(self, res, msg):
|
||||||
#print "MSG: %s RES: %s" % (msg, res)
|
#print "MSG: %s RES: %s" % (msg, res)
|
||||||
|
|
Loading…
Reference in New Issue