mirror of
https://github.com/mihail911/modern-software-dev-assignments.git
synced 2026-10-02 03:54:37 +08:00
20 lines
560 B
Python
20 lines
560 B
Python
def test_create_and_list_notes(client):
|
|
payload = {"title": "Test", "content": "Hello world"}
|
|
r = client.post("/notes/", json=payload)
|
|
assert r.status_code == 201, r.text
|
|
data = r.json()
|
|
assert data["title"] == "Test"
|
|
|
|
r = client.get("/notes/")
|
|
assert r.status_code == 200
|
|
items = r.json()
|
|
assert len(items) >= 1
|
|
|
|
r = client.get("/notes/search/")
|
|
assert r.status_code == 200
|
|
|
|
r = client.get("/notes/search/", params={"q": "Hello"})
|
|
assert r.status_code == 200
|
|
items = r.json()
|
|
assert len(items) >= 1
|