import pytest
from src.project_manager import calculate_track_progress
from src.models import Ticket

def test_calculate_track_progress_empty():
 results = calculate_track_progress([])
 assert results["total"] == 0
 assert results["percentage"] == 0.0
 assert results["completed"] == 0
 assert results["in_progress"] == 0
 assert results["blocked"] == 0
 assert results["todo"] == 0

def test_calculate_track_progress_all_todo():
 tickets = [
  Ticket(id="1", description="desc 1", status="todo"),
  Ticket(id="2", description="desc 2", status="todo")
 ]
 results = calculate_track_progress(tickets)
 assert results["total"] == 2
 assert results["percentage"] == 0.0
 assert results["completed"] == 0
 assert results["todo"] == 2

def test_calculate_track_progress_mixed():
 tickets = [
  Ticket(id="1", description="desc 1", status="completed"),
  Ticket(id="2", description="desc 2", status="in_progress"),
  Ticket(id="3", description="desc 3", status="blocked"),
  Ticket(id="4", description="desc 4", status="todo")
 ]
 results = calculate_track_progress(tickets)
 assert results["total"] == 4
 assert results["completed"] == 1
 assert results["in_progress"] == 1
 assert results["blocked"] == 1
 assert results["todo"] == 1
 assert results["percentage"] == 25.0

def test_calculate_track_progress_all_completed():
 tickets = [
  Ticket(id="1", description="desc 1", status="completed"),
  Ticket(id="2", description="desc 2", status="completed")
 ]
 results = calculate_track_progress(tickets)
 assert results["total"] == 2
 assert results["percentage"] == 100.0
 assert results["completed"] == 2

