Skip to content

Commit

Permalink
Fix tests with bleach 6.1
Browse files Browse the repository at this point in the history
Signed-off-by: Mattia Verga <[email protected]>
  • Loading branch information
mattiaverga committed Oct 14, 2023
1 parent 7cb0629 commit fbc1b6d
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions bodhi-server/tests/views/test_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,19 +265,26 @@ def test_markdown_with_email_in_lt_gt(self):
# markdown tries to obfuscate email addresses, bleach versions prior to
# 6.0.0 restored the email in plain text
bleach_v = pkg_resources.get_distribution('bleach').version
if packaging.version.parse(bleach_v) >= packaging.version.parse("6.0.0"):
if packaging.version.parse(bleach_v) >= packaging.version.parse("6.1.0"):
assert res.json_body['html'] == \
('<div class="markdown">'
'<p>email me at <a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#100;&#117;'
'&#100;&#101;&#64;&#109;&#99;&#112;&#97;&#110;&#116;&#115;&#46;&#111;&#114;'
'&#103;">&amp;#100;&amp;#117;&amp;#100;&amp;#101;&amp;#64;&amp;#109;&amp;#99;'
'&amp;#112;&amp;#97;&amp;#110;&amp;#116;&amp;#115;&amp;#46;&amp;#111;&amp;#114;'
'&amp;#103;</a></p></div>')
else:
'&#103;">&#100;&#117;&#100;&#101;&#64;&#109;&#99;&#112;&#97;&#110;&#116;&#115;'
'&#46;&#111;&#114;&#103;</a></p></div>')
elif packaging.version.parse(bleach_v) < packaging.version.parse("6.0.0"):
assert res.json_body['html'] == \
('<div class="markdown">'
'<p>email me at <a href="mailto:[email protected]">[email protected]</a></p>'
'</div>')
else:
assert res.json_body['html'] == \
('<div class="markdown">'
'<p>email me at <a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#100;&#117;'
'&#100;&#101;&#64;&#109;&#99;&#112;&#97;&#110;&#116;&#115;&#46;&#111;&#114;'
'&#103;">&amp;#100;&amp;#117;&amp;#100;&amp;#101;&amp;#64;&amp;#109;&amp;#99;'
'&amp;#112;&amp;#97;&amp;#110;&amp;#116;&amp;#115;&amp;#46;&amp;#111;&amp;#114;'
'&amp;#103;</a></p></div>')

def test_markdown_with_autolink(self):
res = self.app.get('/markdown', {
Expand Down

0 comments on commit fbc1b6d

Please sign in to comment.