20 lines
619 B
Python
20 lines
619 B
Python
import pytest
|
|
from app import app
|
|
|
|
|
|
# set up a test client for the Flask app.
|
|
# configure the app for testing and provides a client to make requests.
|
|
@pytest.fixture
|
|
def client():
|
|
app.config['TESTING'] = True
|
|
with app.test_client() as client:
|
|
yield client
|
|
|
|
|
|
# test checks that the home page ('/') loads successfully
|
|
# and contains the word 'Welcome' in the response.
|
|
def test_home_page(client):
|
|
response = client.get('/') # Send GET request to home page
|
|
assert response.status_code == 200 # Page should load successfully
|
|
assert b"Welcome" in response.data # Page should contain 'Welcome'
|