/
spirzen
/
it-code-examples
Обзор
Документация
Войти
/
spirzen
/
it-code-examples
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
examples/python/py-502-37-002/main.py
24 строки
543 B
Spirzen
Code migration pack
09 июн 2026, 01:41
09 июн 2026, 01:41
cebc284
Код
Авторство
О чём код?
# tests/test_api.py from fastapi.testclient import TestClient from main import app client = TestClient(app) def test_health(): r = client.get("/health") assert r.status_code == 200 assert r.json() == {"status": "ok"} def test_create_note(): r = client.post("/notes", json={"text": "pytest"}) assert r.status_code == 201 body = r.json() assert body["text"] == "pytest" assert "id" in body def test_create_note_validation(): r = client.post("/notes", json={"text": ""}) assert r.status_code == 422