test_integration.py
python
sha256:2313b6a6353294a0ca08ff579624198da250b99163a86215aed31a905912e360
Land Scooling Lab T0/T2 training contract and seven-tier tests
Human
minor
⚠ breaking
43 days ago
| 1 | """Integration tier tests for Scooling Lab API and BOM generation.""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | import unittest |
| 6 | |
| 7 | from scooling_lab_helpers import PROJECT_ROOT, valid_payload |
| 8 | |
| 9 | from scooling_lab.bom import collect_entries, render_markdown |
| 10 | from scooling_lab.service import TrainingApiService |
| 11 | from scooling_lab.store import TrainingJobStore |
| 12 | |
| 13 | |
| 14 | class ScoolingLabIntegrationTests(unittest.TestCase): |
| 15 | """Integration tests spanning service, fake worker, store, and BOM.""" |
| 16 | |
| 17 | def test_integration_api_to_fake_worker_lifecycle(self) -> None: |
| 18 | """createTrainingJob completes through the fake worker and lists metadata.""" |
| 19 | |
| 20 | service = TrainingApiService(TrainingJobStore()) |
| 21 | created = service.create_training_job(valid_payload("integration")) |
| 22 | self.assertEqual(created["status"], "succeeded") |
| 23 | job_id = str(created["id"]) |
| 24 | |
| 25 | fetched = service.get_training_job(job_id) |
| 26 | self.assertEqual(fetched["id"], job_id) |
| 27 | self.assertEqual(fetched["status"], "succeeded") |
| 28 | |
| 29 | artifacts = service.list_artifacts(job_id) |
| 30 | self.assertEqual(len(artifacts["artifacts"]), 1) |
| 31 | artifact = artifacts["artifacts"][0] |
| 32 | self.assertEqual(artifact["jobId"], job_id) |
| 33 | self.assertTrue(str(artifact["datasetHash"])) |
| 34 | self.assertTrue(str(artifact["artifactHash"])) |
| 35 | |
| 36 | def test_integration_bom_generation_over_real_project_files(self) -> None: |
| 37 | """The real project pyproject and lockfile generate an allowlisted BOM.""" |
| 38 | |
| 39 | entries = collect_entries(PROJECT_ROOT) |
| 40 | markdown = render_markdown(entries) |
| 41 | self.assertIn("scooling-lab", markdown) |
| 42 | self.assertIn("Apache-2.0", markdown) |
| 43 | self.assertNotIn("AGPL-3.0 |", markdown) |
| 44 | |
| 45 | |
| 46 | if __name__ == "__main__": |
| 47 | unittest.main() |
File History
1 commit
sha256:2313b6a6353294a0ca08ff579624198da250b99163a86215aed31a905912e360
Land Scooling Lab T0/T2 training contract and seven-tier tests
Human
minor
⚠
43 days ago