""" Test Suite for Cancer@Home v2 Run with: pytest test_cancer_at_home.py """ import pytest from pathlib import Path class TestConfiguration: """Test configuration file""" def test_config_exists(self): """Check if config file exists""" assert Path("config.yml").exists() def test_requirements_exists(self): """Check if requirements file exists""" assert Path("requirements.txt").exists() class TestBOINC: """Test BOINC integration""" def test_boinc_client_import(self): """Test BOINC client can be imported""" from backend.boinc import BOINCClient assert BOINCClient is not None def test_boinc_task_submission(self): """Test task submission""" from backend.boinc import BOINCClient client = BOINCClient() task_id = client.submit_task("test_task", "test_input.txt") assert task_id is not None assert task_id.startswith("wu_") # Check task exists task = client.get_task_status(task_id) assert task is not None assert task.status == "pending" class TestGDC: """Test GDC integration""" def test_gdc_client_import(self): """Test GDC client can be imported""" from backend.gdc import GDCClient assert GDCClient is not None def test_gdc_client_initialization(self): """Test GDC client initialization""" from backend.gdc import GDCClient client = GDCClient() assert client.api_url == "https://api.gdc.cancer.gov" class TestPipeline: """Test bioinformatics pipeline""" def test_fastq_processor_import(self): """Test FASTQ processor import""" from backend.pipeline import FASTQProcessor assert FASTQProcessor is not None def test_blast_runner_import(self): """Test BLAST runner import""" from backend.pipeline import BLASTRunner assert BLASTRunner is not None def test_variant_caller_import(self): """Test variant caller import""" from backend.pipeline import VariantCaller assert VariantCaller is not None class TestNeo4j: """Test Neo4j integration""" def test_db_manager_import(self): """Test database manager import""" from backend.neo4j import DatabaseManager assert DatabaseManager is not None def test_repositories_import(self): """Test repository imports""" from backend.neo4j import ( GeneRepository, MutationRepository, PatientRepository, CancerTypeRepository ) assert GeneRepository is not None assert MutationRepository is not None assert PatientRepository is not None assert CancerTypeRepository is not None class TestAPI: """Test API endpoints""" def test_api_import(self): """Test API can be imported""" from backend.api import app assert app is not None def test_api_title(self): """Test API metadata""" from backend.api import app assert app.title == "Cancer@Home v2" assert app.version == "2.0.0" class TestDirectoryStructure: """Test directory structure""" def test_backend_exists(self): """Check backend directory""" assert Path("backend").exists() assert Path("backend/__init__.py").exists() def test_modules_exist(self): """Check all modules exist""" modules = [ "backend/api", "backend/boinc", "backend/gdc", "backend/neo4j", "backend/pipeline" ] for module in modules: assert Path(module).exists() assert Path(f"{module}/__init__.py").exists() def test_frontend_exists(self): """Check frontend files""" assert Path("frontend").exists() assert Path("frontend/index.html").exists() def test_documentation_exists(self): """Check documentation files""" docs = [ "README.md", "QUICKSTART.md", "USER_GUIDE.md", "GRAPHQL_EXAMPLES.md", "PROJECT_SUMMARY.md" ] for doc in docs: assert Path(doc).exists() class TestSetupScripts: """Test setup scripts""" def test_setup_scripts_exist(self): """Check setup scripts""" assert Path("setup.ps1").exists() assert Path("setup.sh").exists() def test_run_script_exists(self): """Check run script""" assert Path("run.py").exists() def test_docker_compose_exists(self): """Check Docker compose file""" assert Path("docker-compose.yml").exists() if __name__ == "__main__": pytest.main([__file__, "-v"])