test_js_example.py
This file
Path
examples/javascript/tests/test_js_example.py
28 lines · 730 bytes · Python
Last changed by
Merge pull request #3183 from singingwolfboy/pre-commitDavid Baumgoldbefore adoption1dda032
History of this fileTake it
1import pytest23from flask import template_rendered456@pytest.mark.parametrize(7 ("path", "template_name"),8 (9 ("/", "plain.html"),10 ("/plain", "plain.html"),11 ("/fetch", "fetch.html"),12 ("/jquery", "jquery.html"),13 ),14)15def test_index(app, client, path, template_name):16 def check(sender, template, context):17 assert template.name == template_name1819 with template_rendered.connected_to(check, app):20 client.get(path)212223@pytest.mark.parametrize(24 ("a", "b", "result"), ((2, 3, 5), (2.5, 3, 5.5), (2, None, 2), (2, "b", 2))25)26def test_add(client, a, b, result):27 response = client.post("/add", data={"a": a, "b": b})28 assert response.get_json()["result"] == result