From 525ad786951755b5a0c04beecab9f5e07d9d382c Mon Sep 17 00:00:00 2001 From: Yurii Motov Date: Thu, 27 Nov 2025 15:44:42 +0100 Subject: [PATCH] Fix test coverage for `settings.app03` --- tests/test_tutorial/test_settings/test_app03.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/test_tutorial/test_settings/test_app03.py b/tests/test_tutorial/test_settings/test_app03.py index e6dc450bd..d9872c15f 100644 --- a/tests/test_tutorial/test_settings/test_app03.py +++ b/tests/test_tutorial/test_settings/test_app03.py @@ -2,6 +2,7 @@ import importlib from types import ModuleType import pytest +from fastapi.testclient import TestClient from pytest import MonkeyPatch from ...utils import needs_py39, needs_pydanticv1, needs_pydanticv2 @@ -43,3 +44,16 @@ def test_settings_pv1(mod_path: str, monkeypatch: MonkeyPatch): assert settings.app_name == "Awesome API" assert settings.admin_email == "admin@example.com" assert settings.items_per_user == 50 + + +@needs_pydanticv2 +def test_endpoint(main_mod: ModuleType, monkeypatch: MonkeyPatch): + monkeypatch.setenv("ADMIN_EMAIL", "admin@example.com") + client = TestClient(main_mod.app) + response = client.get("/info") + assert response.status_code == 200 + assert response.json() == { + "app_name": "Awesome API", + "admin_email": "admin@example.com", + "items_per_user": 50, + }