From: david-sarah Date: Sat, 17 Dec 2011 04:31:30 +0000 (+0000) Subject: Tests for ref #1592. X-Git-Url: https://git.rkrishnan.org/pf/content/en/seg/index.php?a=commitdiff_plain;h=531f562fcfcb7b68add2d937eaf362ba7631deb1;p=tahoe-lafs%2Ftahoe-lafs.git Tests for ref #1592. --- diff --git a/src/allmydata/test/test_web.py b/src/allmydata/test/test_web.py index 04c51bdc..d918bc15 100644 --- a/src/allmydata/test/test_web.py +++ b/src/allmydata/test/test_web.py @@ -42,6 +42,9 @@ unknown_rwcap = u"lafs://from_the_future_rw_\u263A".encode('utf-8') unknown_rocap = u"ro.lafs://readonly_from_the_future_ro_\u263A".encode('utf-8') unknown_immcap = u"imm.lafs://immutable_from_the_future_imm_\u263A".encode('utf-8') +FAVICON_MARKUP = '' + + class FakeStatsProvider: def get_stats(self): stats = {'stats': {}, 'counters': {}} @@ -500,6 +503,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi d = self.GET("/") def _check(res): self.failUnlessIn('Welcome To Tahoe-LAFS', res) + self.failUnlessIn(FAVICON_MARKUP, res) self.s.basedir = 'web/test_welcome' fileutil.make_dirs("web/test_welcome") @@ -512,6 +516,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi d = self.GET("/provisioning/") def _check(res): self.failUnlessIn('Provisioning Tool', res) + self.failUnlessIn(FAVICON_MARKUP, res) fields = {'filled': True, "num_users": int(50e3), @@ -531,6 +536,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi d.addCallback(_check) def _check2(res): self.failUnlessIn('Provisioning Tool', res) + self.failUnlessIn(FAVICON_MARKUP, res) self.failUnlessIn("Share space consumed: 167.01TB", res) fields = {'filled': True, @@ -1295,6 +1301,8 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi self.failUnlessIn('input checked="checked" type="radio" id="mkdir-sdmf" value="sdmf" name="format"', html) self.failUnlessIn('input type="radio" id="mkdir-mdmf" value="mdmf" name="format"', html) + self.failUnlessIn(FAVICON_MARKUP, html) + def test_GET_DIRECTORY_html(self): d = self.GET(self.public_url + "/foo", followRedirect=True) def _check(html): @@ -1454,6 +1462,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi self.failUnlessIn("sub", manifest) self.failUnlessIn(self._sub_uri, manifest) self.failUnlessIn("sub/baz.txt", manifest) + self.failUnlessIn(FAVICON_MARKUP, manifest) d.addCallback(_got_html) # both t=status and unadorned GET should be identical @@ -2614,6 +2623,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi def _check_html(res): self.failUnlessIn("Objects Checked: 10", res) self.failUnlessIn("Objects Healthy: 10", res) + self.failUnlessIn(FAVICON_MARKUP, res) d.addCallback(_check_html) d.addCallback(lambda res: @@ -2668,6 +2678,8 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi self.failUnlessIn("Objects Healthy (after repair): 10", res) self.failUnlessIn("Objects Unhealthy (after repair): 0", res) self.failUnlessIn("Corrupt Shares (after repair): 0", res) + + self.failUnlessIn(FAVICON_MARKUP, res) d.addCallback(_check_html) return d @@ -3360,6 +3372,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi def _check(res): self.failUnlessIn('name="when_done" value="."', res) self.failUnless(re.search(r'name="from_name" value="bar\.txt"', res)) + self.failUnlessIn(FAVICON_MARKUP, res) d.addCallback(_check) return d @@ -3865,7 +3878,8 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi def test_incident(self): d = self.POST("/report_incident", details="eek") def _done(res): - self.failUnless("Thank you for your report!" in res, res) + self.failIfIn("", res) + self.failUnlessIn("Thank you for your report!", res) d.addCallback(_done) return d @@ -4006,6 +4020,7 @@ class Grid(GridTestMixin, WebErrorMixin, ShouldFailMixin, testutil.ReallyEqualMi def _got_html_good(res): self.failUnlessIn("Healthy", res) self.failIfIn("Not Healthy", res) + self.failUnlessIn(FAVICON_MARKUP, res) d.addCallback(_got_html_good) d.addCallback(self.CHECK, "good", "t=check&return_to=somewhere") def _got_html_good_return_to(res): @@ -4146,6 +4161,7 @@ class Grid(GridTestMixin, WebErrorMixin, ShouldFailMixin, testutil.ReallyEqualMi self.failUnlessIn("Healthy", res) self.failIfIn("Not Healthy", res) self.failUnlessIn("No repair necessary", res) + self.failUnlessIn(FAVICON_MARKUP, res) d.addCallback(_got_html_good) d.addCallback(self.CHECK, "sick", "t=check&repair=true")