Add basic unit tests for Flask app
CI/CD Pipeline - Weather App 🌤️ / test (push) Successful in 40s
CI/CD Pipeline - Weather App 🌤️ / deploy (push) Has been cancelled
CI/CD Pipeline - Weather App 🌤️ / build_and_push_image (push) Has been cancelled

This commit is contained in:
ahmedgamalyousef
2025-10-14 20:02:42 +03:00
parent 3075e5b0d1
commit 295e7cb9c6
+21
View 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