Fetches the content of a specific test file.
(app_name: str, test_name: str)
| 689 | |
| 690 | @app.get("/dev/apps/{app_name}/tests/{test_name}") |
| 691 | async def get_test_content(app_name: str, test_name: str) -> dict[str, Any]: |
| 692 | """Fetches the content of a specific test file.""" |
| 693 | agent_dir = os.path.join(self.agents_dir, app_name) |
| 694 | tests_dir = os.path.join(agent_dir, "tests") |
| 695 | |
| 696 | if not test_name.endswith(".json"): |
| 697 | test_name += ".json" |
| 698 | |
| 699 | test_file_path = os.path.join(tests_dir, test_name) |
| 700 | |
| 701 | if not os.path.exists(test_file_path): |
| 702 | raise HTTPException(status_code=404, detail="Test file not found") |
| 703 | |
| 704 | with open(test_file_path, "r") as f: |
| 705 | return json.load(f) |
| 706 | |
| 707 | # ========== EVALUATION ENDPOINTS ========== |
| 708 |