{% extends "base.html" %} {% block title %}Admin & Testing - Data Science Lab{% endblock %} {% block content %}
Run validation checks on all ingested data to ensure quality and consistency.
| Table | Row Count |
|---|
| Endpoint | Method | Status | Duration | Timestamp |
|---|
import pytest
from app import create_app
@pytest.fixture
def client():
"""Create test client."""
app = create_app()
app.config['TESTING'] = True
with app.test_client() as client:
yield client
def test_api_summary(client):
"""Test the /api/summary endpoint."""
response = client.get('/api/summary')
assert response.status_code == 200
data = response.get_json()
assert 'tables' in data
def test_model_train(client):
"""Test model training endpoint."""
response = client.post('/api/model/train',
json={'model_type': 'linear_regression'})
assert response.status_code == 200
data = response.get_json()
assert 'metrics' in data
def test_sql_readonly(client):
"""Test that SQL endpoint blocks write operations."""
response = client.post('/api/sql/execute',
json={'query': 'DROP TABLE raw_data'})
assert response.status_code == 400 # Should reject
# Run: pytest tests/ -v| Test Type | What It Tests | Example |
|---|---|---|
| Unit Test | Single function | Test price prediction returns a number |
| Integration Test | Component interaction | Test ingestion โ database โ query |
| API Test | HTTP endpoints | Test GET /api/housing returns valid JSON |
| Data Validation | Data quality | Test no negative prices in fact table |
1. Run the data validation and fix any issues found.
2. Check the API logs โ which endpoints are most frequently called?
3. Write a test that verifies the pipeline runs without errors.