From 1a8ddbdac6b1ab60329facdbbcf3d57c9361dcb5 Mon Sep 17 00:00:00 2001 From: Jonah Lawrence Date: Fri, 7 Oct 2022 16:01:30 +0000 Subject: [PATCH] Add tests for svg escaping --- tests/templates/escaping_template.svg | 1 + tests/test_templating.py | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 tests/templates/escaping_template.svg diff --git a/tests/templates/escaping_template.svg b/tests/templates/escaping_template.svg new file mode 100644 index 00000000..280402dd --- /dev/null +++ b/tests/templates/escaping_template.svg @@ -0,0 +1 @@ +{{ text }} \ No newline at end of file diff --git a/tests/test_templating.py b/tests/test_templating.py index 863417c0..3acdbc2e 100644 --- a/tests/test_templating.py +++ b/tests/test_templating.py @@ -114,6 +114,15 @@ def test_escaping_without_template_filename(app, client, req_ctx): assert flask.render_template("mail.txt", foo="") == " Mail" +def test_escaping_svg(app, client): + @app.route("/") + def index(): + return flask.render_template("escaping_template.svg", text="") + + rv = client.get("/") + assert rv.data == b"<test>" + + def test_macros(app, req_ctx): macro = flask.get_template_attribute("_macro.html", "hello") assert macro("World") == "Hello World!"