-
-
Notifications
You must be signed in to change notification settings - Fork 19
Closed
Description
=================================== FAILURES ===================================
____________________ test_simple_rewrite[badly_escaped_src] ____________________
input_content = '<img src="image.png?param1=value1¶m2=value2">'
expected_output = '<img src="image.png%3Fparam1%3Dvalue1¶m2%3Dvalue2">'
@pytest.mark.parametrize(
"input_content,expected_output",
[
pytest.param(
"""<a type="whatever"></a>""",
"""<a type="whatever"></a>""",
id="double_quoted_attr",
),
pytest.param(
"<a type='whatever'></a>",
"""<a type="whatever"></a>""",
id="single_quoted_attr",
),
pytest.param(
"""<a type="wha"tever"></a>""",
"""<a type="wha"tever"></a>""",
id="uppercase_named_reference_in_attr",
),
pytest.param(
"""<a type="wha"tever"></a>""",
"""<a type="wha"tever"></a>""",
id="numeric_reference_in_attr",
),
pytest.param(
"""<a type="whaÆtever"></a>""",
"""<a type="whaÆtever"></a>""",
id="numeric_reference_in_attr",
),
pytest.param(
"""<img src="image.png?param1=value1¶m2=value2">""",
"""<img src="image.png%3Fparam1%3Dvalue1¶m2%3Dvalue2">""",
id="badly_escaped_src",
),
],
)
def test_simple_rewrite(input_content: str, expected_output: str):
> assert (
HtmlRewriter(
ArticleUrlRewriter(article_url=HttpUrl("http://example.com/")),
None,
None,
None,
)
.rewrite(input_content)
.content
== expected_output
)
E assert '<img src="image.png%3Fparam1%3Dvalue1%26param2%3Dvalue2">' == '<img src="image.png%3Fparam1%3Dvalue1¶m2%3Dvalue2">'
E
E - <img src="image.png%3Fparam1%3Dvalue1¶m2%3Dvalue2">
E ? ^
E + <img src="image.png%3Fparam1%3Dvalue1%26param2%3Dvalue2">
E ? ^^^
tests/rewriting/test_html_rewriting.py:798: AssertionError
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working