Files
fastapi/tests/test_tutorial/test_settings/test_app02.py
Marcelo Trylesinski fa2c750443 Add the docs_src directory to test coverage and update tests (#1904)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-29 11:26:07 +02:00

18 lines
442 B
Python

from fastapi.testclient import TestClient
from pytest import MonkeyPatch
from docs_src.settings.app02 import main, test_main
client = TestClient(main.app)
def test_settings(monkeypatch: MonkeyPatch):
monkeypatch.setenv("ADMIN_EMAIL", "admin@example.com")
settings = main.get_settings()
assert settings.app_name == "Awesome API"
assert settings.items_per_user == 50
def test_override_settings():
test_main.test_app()