/
spirzen
/
it-code-examples
Обзор
Документация
Войти
/
spirzen
/
it-code-examples
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
examples/python/py-502-37-003/main.py
16 строк
444 B
Spirzen
Code migration pack
09 июн 2026, 01:41
09 июн 2026, 01:41
cebc284
Код
Авторство
О чём код?
@pytest.fixture def auth_headers(client): r = client.post( "/token", data={"username": "demo", "password": "demo123"}, ) token = r.json()["access_token"] return {"Authorization": f"Bearer {token}"} def test_notes_require_auth(client): assert client.get("/notes").status_code == 401 def test_notes_with_token(client, auth_headers): assert client.get("/notes", headers=auth_headers).status_code == 200