File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 1+ import pytest
2+ from app import create_app
3+
4+ @pytest .fixture
5+ def client ():
6+ """Create a test client for the Flask application."""
7+ app = create_app ()
8+ app .testing = True
9+ return app .test_client ()
Original file line number Diff line number Diff line change 1+ """Test if the home page returns status code 200 and contains expected content"""
2+ def test_home_status_code (client ):
3+ response = client .get ("/" )
4+ assert response .status_code == 200
5+ assert b"Hello" in response .data or b"Rero+" in response .data
6+
7+ """ Test if the help page returns status code 200 and contains expected content"""
8+ def test_help_status_code (client ):
9+ response = client .get ("/help" )
10+ assert response .status_code == 200
11+ assert b"Aide" in response .data or b"Help" in response .data
12+
13+ """ Test if the 404 error handler returns status code 404 and contains expected content"""
14+ def test_404_status_code (client ):
15+ response = client .get ("/nonexistent_page" )
16+ assert response .status_code == 404
17+ assert b"Page not found" in response .data
You can’t perform that action at this time.
0 commit comments