Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ async def generate_productivity_report() -> ProductivityReport:
app = FastAPI(title="Productivity Reporting System")

@app.get("/status")
def get_status():
def get_status()
return {"status": "ok"}


Expand Down
19 changes: 19 additions & 0 deletions app/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from pydantic import BaseModel, Field

class TaskCompletionMetrics(BaseModel):
"""Model representing task completion metrics."""

total_tasks: int = Field(..., ge=0, description="Total number of tasks")
completed_tasks: int = Field(..., ge=0, description="Number of completed tasks")
completion_percentage: float = Field(..., ge=0, le=100, description="Completion percentage (0-100)")
pending_tasks: int = Field(..., ge=0, description="Number of pending tasks")

class Config:
json_schema_extra = {
"example": {
"total_tasks": 10,
"completed_tasks": 7,
"completion_percentage": 70.0,
"pending_tasks": 3,
}
}
41 changes: 41 additions & 0 deletions tests/integration/test_main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import pytest
from httpx import AsyncClient
from app.main import app

@pytest.mark.asyncio
@pytest.mark.integration
async def test_get_task_status_existing_task_returns_status() -> None:
async with AsyncClient(app=app, base_url="http://test") as client:
resp = await client.get("/task/1/status")
assert resp.status_code == 200
body = resp.json()
assert body["task_id"] == "1"
assert body["status"] in {"pending", "in_progress", "complete"}
@pytest.mark.asyncio
@pytest.mark.integration
async def test_get_task_status_unknown_task_returns_404() -> None:
async with AsyncClient(app=app, base_url="http://test") as client:
resp = await client.get("/task/999/status")
assert resp.status_code == 404
assert resp.json()["detail"] == "Task not found"


@pytest.fixture
async def task_fixture() -> dict:
"""Fixture to create a test task before each test."""
async with AsyncClient(app=app, base_url="http://test") as client:
response = await client.post("/task", json={"title": "Test Task"})
assert response.status_code == 201
return response.json()


@pytest.mark.asyncio
@pytest.mark.integration
async def test_get_task_status_existing_task_with_fixture(task_fixture: dict) -> None:
task_id = task_fixture["task_id"]
async with AsyncClient(app=app, base_url="http://test") as client:
resp = await client.get(f"/task/{task_id}/status")
assert resp.status_code == 200
body = resp.json()
assert body["task_id"] == str(task_id)
assert body["status"] in {"pending", "in_progress", "complete"}
2 changes: 1 addition & 1 deletion trainings-tasks/00_prerequists_intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ To ensure a smooth session, please ensure the following items are verified befor
- **Visual Studio Code**: Recommended to use latest stable VS Code.
- **Required Extensions**: Install the [GitHub Copilot](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot) and [GitHub Pull Requests & Issues](https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-pull-request-github) extensions in VS Code.
- **`uv` Package Manager**: The `uv` utility is required for fast environment and dependency management: [uv Installation Guide](https://docs.astral.sh/uv/getting-started/installation/)
- **Code Base**: Fork the [course repository](https://github.com/YvFrey/training-github-copilot/tree/main) to your own GitHub account. Clone **your project** locally. This setup ensures you have all necessary permissions in Github when running your custom agents.
- **Code Base**: Fork the [course repository](https://github.com/YvFrey/github-copilot-training.git) to your own GitHub account. Clone **your project** locally. This setup ensures you have all necessary permissions in Github when running your custom agents.

### ⚠️ Important: Feature Alignment and Version Check

Expand Down