Fix microversion test: handle different HTML renderings

The rendered HTML changes a bit between beautifulsoup4 4.6.3 and 4.7.1.
A regular expression can handle both cases.

Change-Id: I64d4c56b480d54b50e58141999636b91b5fb4f94
This commit is contained in:
Luigi Toscano 2019-01-11 11:58:11 +01:00
parent f58a59d09f
commit 4e56d09daf
1 changed files with 6 additions and 6 deletions

View File

@ -45,13 +45,13 @@ class TestMicroversions(base.TestCase):
def test_rest_method(self):
"""Test that min / max mv css class attributes are set"""
content = self.soup.find_all(class_='rp_min_ver_2_17')
self.assertIn(
'<div class="operation-grp rp_min_ver_2_17 rp_max_ver_2_19 ">',
str(content[0]))
self.assertRegexpMatches(
str(content[0]),
'^<div class="operation-grp rp_min_ver_2_17 rp_max_ver_2_19 ?"')
content = self.soup.find_all(class_='rp_max_ver_2_19')
self.assertIn(
'<div class="operation-grp rp_min_ver_2_17 rp_max_ver_2_19 ">',
str(content[0]))
self.assertRegexpMatches(
str(content[0]),
'^<div class="operation-grp rp_min_ver_2_17 rp_max_ver_2_19 ?"')
def test_parameters_table(self):
"""Test that min / max mv css class attributes are set in params"""