htmx_examples / tests /test_click_to_edit.py
phihung's picture
refactor
9d8008e
raw
history blame contribute delete
517 Bytes
from starlette.testclient import TestClient
from tutorial.htmx import _01_click_to_edit as module
def test_app():
client = TestClient(module.app)
def check(r):
c = module.current
assert r.status_code == 200
assert c.name in r.text
assert c.email in r.text
r = client.get("/contact")
check(r)
r = client.get("/contact/edit")
check(r)
r = client.put("/contact", data={"name": "AAA", "email": "BB"})
check(r)
assert module.current.name == "AAA"