Add basic unit tests for Flask app
هذا الالتزام موجود في:
21
test_app.py
Normal file
21
test_app.py
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import pytest
|
||||||
|
from app import app
|
||||||
|
|
||||||
|
# ✅ Basic test to ensure the Flask app starts successfully
|
||||||
|
@pytest.fixture
|
||||||
|
def client():
|
||||||
|
app.testing = True
|
||||||
|
with app.test_client() as client:
|
||||||
|
yield client
|
||||||
|
|
||||||
|
|
||||||
|
def test_home_route(client):
|
||||||
|
"""Test that the home route returns 200 OK"""
|
||||||
|
response = client.get('/')
|
||||||
|
assert response.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
|
def test_weather_page_content(client):
|
||||||
|
"""Check if page contains expected content"""
|
||||||
|
response = client.get('/')
|
||||||
|
assert b"Weather" in response.data or b"temperature" in response.data
|
||||||
المرجع في مشكلة جديدة
حظر مستخدم