#244 Fix test failing due to additional HTML attributes
Merged 7 years ago by skrzepto. Opened 7 years ago by lsedlar.
lsedlar/fedora-hubs fix-tests  into  develop

@@ -37,8 +37,8 @@ 

          with tests.auth_set(app, None):  # check_auth doesn't load in unittest

              result = self.app.get('/ralph', follow_redirects=True)

              self.assertEqual(result.status_code, 200)

-             str_expected = '<h5>Ralph</h5>'

-             self.assertTrue(str_expected in result.data)

+             match_expected = r'<h5[^>]*>Ralph</h5>'

+             self.assertRegexpMatches(result.data, match_expected)

              str_expected = 'Not logged in.'

              self.assertTrue(str_expected in result.data)

  

The HTML contains an attribute which causes the expected string to not
be found. This patch updates the test to use a regular expression, which
should be a tad more reliable.

Pull-Request has been merged by skrzepto

7 years ago
Metadata