"""Tests for API endpoints"""
import pytest
from fastapi.testclient import TestClient
from app.main import app

client = TestClient(app)


def test_health():
    """Test health endpoint"""
    response = client.get("/health")
    assert response.status_code == 200
    assert response.json() == {"status": "ok"}


def test_root_redirect():
    """Test root redirect"""
    response = client.get("/", follow_redirects=False)
    assert response.status_code == 307  # Redirect


def test_web_index():
    """Test web index page"""
    response = client.get("/web/")
    assert response.status_code == 200
    assert "Sports Predictor" in response.text

