TRM-coding | be1a619 | 2025-06-11 22:18:02 +0800 | [diff] [blame^] | 1 | import pytest |
2 | from app import create_app | ||||
3 | |||||
4 | @pytest.fixture | ||||
5 | def client(): | ||||
6 | app = create_app() | ||||
7 | app.config['TESTING'] = True | ||||
8 | return app.test_client() | ||||
9 | |||||
10 | def test_index(client): | ||||
11 | rv = client.get('/') | ||||
12 | assert rv.status_code == 200 | ||||
13 | json_data = rv.get_json() | ||||
14 | assert json_data['message'] == 'Hello, Flask!' |