From: Leif Ryge Date: Sun, 31 Jan 2016 16:16:53 +0000 (+0000) Subject: Make tests work with both Nevow 0.11 and 0.12 X-Git-Url: https://git.rkrishnan.org/vdrive/%5B/%5D%20/COPYING.TGPPL.html?a=commitdiff_plain;h=55fdbaa3a23c3e038a62d73af72cee1bc9dbae29;p=tahoe-lafs%2Ftahoe-lafs.git Make tests work with both Nevow 0.11 and 0.12 closes #2663 --- diff --git a/src/allmydata/test/test_system.py b/src/allmydata/test/test_system.py index 1887c7e2..257883b8 100644 --- a/src/allmydata/test/test_system.py +++ b/src/allmydata/test/test_system.py @@ -1112,7 +1112,7 @@ class SystemTest(SystemTestMixin, RunBinTahoeMixin, unittest.TestCase): d.addCallback(lambda res: getPage(self.helper_webish_url)) def _got_welcome_helper(page): html = page.replace('\n', ' ') - self.failUnless(re.search('Connected', html), page) + self.failUnless(re.search('', html), page) self.failUnlessIn("Not running helper", page) d.addCallback(_got_welcome_helper) diff --git a/src/allmydata/test/test_web.py b/src/allmydata/test/test_web.py index 5b151ecb..f2c132c9 100644 --- a/src/allmydata/test/test_web.py +++ b/src/allmydata/test/test_web.py @@ -627,17 +627,17 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi self.failUnlessIn(FAVICON_MARKUP, res) self.failUnlessIn('Recent and Active Operations', res) self.failUnlessIn('Operational Statistics', res) - self.failUnlessIn('', res) + self.failUnless(re.search('',res), res) self.failUnlessIn('Page rendered at', res) self.failUnlessIn('Tahoe-LAFS code imported from:', res) res_u = res.decode('utf-8') self.failUnlessIn(u'fake_nickname \u263A', res_u) self.failUnlessIn(u'
other_nickname \u263B
', res_u) self.failUnlessIn(u'Connected to 1\n of 2 known storage servers', res_u) - self.failUnlessIn(u'
Connected
\n 1d\u00A00h\u00A00m\u00A050s', res_u) - self.failUnlessIn(u'
Disconnected
\n 1d\u00A00h\u00A00m\u00A035s', res_u) - self.failUnlessIn(u'1d\u00A00h\u00A00m\u00A030s', res_u) - self.failUnlessIn(u'1d\u00A00h\u00A00m\u00A025s', res_u) + self.failUnless(re.search(u'
\n 1d\u00A00h\u00A00m\u00A050s', res_u), res_u) + self.failUnless(re.search(u'
\n 1d\u00A00h\u00A00m\u00A035s', res_u), res_u) + self.failUnless(re.search(u'1d\u00A00h\u00A00m\u00A030s', res_u), res_u) + self.failUnless(re.search(u'1d\u00A00h\u00A00m\u00A025s', res_u), res_u) self.failUnlessIn(u'\u00A9 Tahoe-LAFS Software Foundation', res_u) self.failUnlessIn('

Available

', res) self.failUnlessIn('123.5kB', res) @@ -668,7 +668,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi html = res.replace('\n', ' ') self.failUnlessIn('
pb://someIntroducer/[censored]
', html) self.failIfIn('pb://someIntroducer/secret', html) - self.failUnless(re.search('Disconnected', html), res) + self.failUnless(re.search('', html), res) d.addCallback(_check_introducer_not_connected_unguessable) # introducer connected, unguessable furl @@ -681,7 +681,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi html = res.replace('\n', ' ') self.failUnlessIn('
pb://someIntroducer/[censored]
', html) self.failIfIn('pb://someIntroducer/secret', html) - self.failUnless(re.search('Connected', html), res) + self.failUnless(re.search('', html), res) d.addCallback(_check_introducer_connected_unguessable) # introducer connected, guessable furl @@ -693,7 +693,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi def _check_introducer_connected_guessable(res): html = res.replace('\n', ' ') self.failUnlessIn('
pb://someIntroducer/introducer
', html) - self.failUnless(re.search('Connected', html), res) + self.failUnless(re.search('', html), res) d.addCallback(_check_introducer_connected_guessable) return d @@ -707,7 +707,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi d.addCallback(_set_no_helper) def _check_no_helper(res): html = res.replace('\n', ' ') - self.failUnless(re.search('Not Configured', html), res) + self.failUnless(re.search('', html), res) d.addCallback(_check_no_helper) # enable helper, not connected @@ -720,7 +720,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi html = res.replace('\n', ' ') self.failUnlessIn('
pb://someHelper/[censored]
', html) self.failIfIn('pb://someHelper/secret', html) - self.failUnless(re.search('Disconnected', html), res) + self.failUnless(re.search('', html), res) d.addCallback(_check_helper_not_connected) # enable helper, connected @@ -733,7 +733,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi html = res.replace('\n', ' ') self.failUnlessIn('
pb://someHelper/[censored]
', html) self.failIfIn('pb://someHelper/secret', html) - self.failUnless(re.search('Connected', html), res) + self.failUnless(re.search('', html), res) d.addCallback(_check_helper_connected) return d @@ -1528,7 +1528,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi def _check_upload_and_mkdir_forms(self, html): # We should have a form to create a file, with radio buttons that allow # the user to toggle whether it is a CHK/LIT (default), SDMF, or MDMF file. - self.failUnlessIn('name="t" value="upload"', html) + self.failUnless(re.search('', html), html) self.failUnless(re.search('', html), html) self.failUnless(re.search('.*Create a new directory in this directory.*', re.I) + MKDIR_BUTTON_RE=re.compile('.*Create a new directory in this directory.*', re.I) self.failUnless(MKDIR_BUTTON_RE.search(res), res) d.addCallback(_check4) @@ -3277,10 +3277,10 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi d = self.GET("/") def _after_get_welcome_page(res): MKDIR_BUTTON_RE = re.compile( - '
[ ]*' - '[ ]*' - '') + '.*' + '[ ]*' + '[ ]*' + '') html = res.replace('\n', ' ') mo = MKDIR_BUTTON_RE.search(html) self.failUnless(mo, html) @@ -3893,8 +3893,8 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi d = self.GET(self.public_url + "/foo?t=rename-form&name=bar.txt", followRedirect=True) def _check(res): - self.failUnlessIn('name="when_done" value="."', res) - self.failUnless(re.search(r'name="from_name" value="bar\.txt"', res)) + self.failUnless(re.search('', res), res) + self.failUnless(re.search(r'', res), res) self.failUnlessIn(FAVICON_MARKUP, res) d.addCallback(_check) return d