initial commit
This commit is contained in:
22
backend/tests/test_main.py
Normal file
22
backend/tests/test_main.py
Normal file
@@ -0,0 +1,22 @@
|
||||
import pytest
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from app import app
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def client():
|
||||
with TestClient(app) as client:
|
||||
yield client
|
||||
|
||||
|
||||
def test_home_route(client):
|
||||
response = client.get("/")
|
||||
assert response.status_code == 200
|
||||
assert response.json() == {"message": "Hello"}
|
||||
|
||||
|
||||
def test_about_route(client):
|
||||
response = client.get("/about")
|
||||
assert response.status_code == 200
|
||||
assert response.json() == {"message": "This is the about page."}
|
||||
Reference in New Issue
Block a user