Coverage for tests/test_tutorial/test_settings/test_app02.py: 100%

13 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2024-08-08 03:53 +0000

1from pytest import MonkeyPatch 1abcde

2 

3from ...utils import needs_pydanticv2 1abcde

4 

5 

6@needs_pydanticv2 1abcde

7def test_settings(monkeypatch: MonkeyPatch): 1abcde

8 from docs_src.settings.app02 import main 1abcde

9 

10 monkeypatch.setenv("ADMIN_EMAIL", "admin@example.com") 1abcde

11 settings = main.get_settings() 1abcde

12 assert settings.app_name == "Awesome API" 1abcde

13 assert settings.items_per_user == 50 1abcde

14 

15 

16@needs_pydanticv2 1abcde

17def test_override_settings(): 1abcde

18 from docs_src.settings.app02 import test_main 1abcde

19 

20 test_main.test_app() 1abcde