Coverage for docs_src/settings/app02/test_main.py: 100%

11 statements  

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

1from fastapi.testclient import TestClient 1abcde

2 

3from .config import Settings 1abcde

4from .main import app, get_settings 1abcde

5 

6client = TestClient(app) 1abcde

7 

8 

9def get_settings_override(): 1abcde

10 return Settings(admin_email="testing_admin@example.com") 1abcde

11 

12 

13app.dependency_overrides[get_settings] = get_settings_override 1abcde

14 

15 

16def test_app(): 1abcde

17 response = client.get("/info") 1abcde

18 data = response.json() 1abcde

19 assert data == { 1abcde

20 "app_name": "Awesome API", 

21 "admin_email": "testing_admin@example.com", 

22 "items_per_user": 50, 

23 }