From 88b7784f3929bc4091f22a432bdbd7f4590a1195 Mon Sep 17 00:00:00 2001 From: Sajith Sasidharan Date: Thu, 30 Apr 2020 15:09:10 -0400 Subject: [PATCH] Use BeautifulSoup in test.test_system.SystemTest.test_filesystem --- src/allmydata/test/test_system.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/allmydata/test/test_system.py b/src/allmydata/test/test_system.py index 2b7660705..3f8a363d2 100644 --- a/src/allmydata/test/test_system.py +++ b/src/allmydata/test/test_system.py @@ -3,6 +3,8 @@ from __future__ import print_function import os, re, sys, time, json from functools import partial +from bs4 import BeautifulSoup + from twisted.internet import reactor from twisted.trial import unittest from twisted.internet import defer @@ -38,6 +40,9 @@ from .common import ( SameProcessStreamEndpointAssigner, ) from .common_web import do_http, Error +from .web.common import ( + assert_soup_has_tag_with_attributes +) # TODO: move this to common or common_util from allmydata.test.test_runner import RunBinTahoeMixin @@ -1771,8 +1776,11 @@ class SystemTest(SystemTestMixin, RunBinTahoeMixin, unittest.TestCase): # get the welcome page from the node that uses the helper too d.addCallback(lambda res: do_http("get", self.helper_webish_url)) def _got_welcome_helper(page): - html = page.replace('\n', ' ') - self.failUnless(re.search('', html), page) + soup = BeautifulSoup(page, 'html5lib') + assert_soup_has_tag_with_attributes( + self, soup, u"img", + { u"alt": u"Connected", u"src": u"img/connected-yes.png" } + ) self.failUnlessIn("Not running helper", page) d.addCallback(_got_welcome_helper)