mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-20 13:33:09 +00:00
assert about connected storage servers
This commit is contained in:
parent
f9956f4c43
commit
e4d556b49e
@ -45,6 +45,15 @@ def assert_soup_has_tag_with_attributes_and_content(testcase, soup, tag_name, co
|
||||
assert_soup_has_tag_with_content(testcase, soup, tag_name, content)
|
||||
|
||||
|
||||
def _normalized_contents(tag):
|
||||
"""
|
||||
:returns: all the text contents of the tag with whitespace
|
||||
normalized: all newlines removed and at most one space between
|
||||
words.
|
||||
"""
|
||||
return u" ".join(tag.text.split())
|
||||
|
||||
|
||||
def assert_soup_has_tag_with_content(testcase, soup, tag_name, content):
|
||||
"""
|
||||
Using a ``TestCase`` object ``testcase``, assert that the passed
|
||||
@ -55,10 +64,14 @@ def assert_soup_has_tag_with_content(testcase, soup, tag_name, content):
|
||||
for tag in tags:
|
||||
if content in tag.contents:
|
||||
return
|
||||
# make this a "fuzzy" option?
|
||||
|
||||
# make these "fuzzy" options?
|
||||
for c in tag.contents:
|
||||
if content in c:
|
||||
return
|
||||
|
||||
if content in _normalized_contents(tag):
|
||||
return
|
||||
# seems like exceptions can't support unicode text in python2??
|
||||
testcase.fail(
|
||||
u"No <{}> tag contains the text '{}'".format(tag_name, content).encode('utf8')
|
||||
|
@ -871,7 +871,10 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi
|
||||
u"other_nickname \u263B",
|
||||
{u"class": u"nickname"},
|
||||
)
|
||||
# self.failUnlessIn(u'Connected to <span>1</span>\n of <span>2</span> known storage servers', res_u)
|
||||
assert_soup_has_tag_with_content(
|
||||
self, soup, u"h2",
|
||||
u"Connected to 1 of 2 known storage servers"
|
||||
)
|
||||
divs = soup.find_all(u"div")
|
||||
found_status = False
|
||||
for div in divs:
|
||||
|
Loading…
Reference in New Issue
Block a user