Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 21, 03:37 UTC
| 1 | """Cross-SDK compatibility tests. |
| 2 | |
| 3 | These tests verify that the Python SDK uses identical fixtures |
| 4 | to the TypeScript SDK, ensuring webhook verification works consistently |
| 5 | across both SDKs. |
| 6 | """ |
| 7 | |
| 8 | import json |
| 9 | |
| 10 | import pytest |
| 11 | |
| 12 | from tests.conftest import ( |
| 13 | get_py_fixtures_dir, |
| 14 | get_py_json_schema_corpus_dir, |
| 15 | get_ts_fixtures_dir, |
| 16 | get_ts_json_schema_corpus_dir, |
| 17 | ) |
| 18 | |
| 19 | |
| 20 | class TestCrossSDKFixtureCompatibility: |
| 21 | """Tests verifying Python and TypeScript fixtures are synchronized.""" |
| 22 | |
| 23 | @pytest.mark.parametrize( |
| 24 | "fixture_name", |
| 25 | [ |
| 26 | "golden-signatures.json", |
| 27 | "v1-github-push.json", |
| 28 | "v2-github-push.json", |
| 29 | "v3-github-push.json", |
| 30 | ], |
| 31 | ) |
| 32 | def test_fixtures_are_identical(self, fixture_name: str) -> None: |
| 33 | """Verify TypeScript and Python fixtures are byte-identical.""" |
| 34 | ts_path = get_ts_fixtures_dir() / fixture_name |
| 35 | py_path = get_py_fixtures_dir() / fixture_name |
| 36 | |
| 37 | with open(ts_path) as f: |
| 38 | ts_content = json.load(f) |
| 39 | with open(py_path) as f: |
| 40 | py_content = json.load(f) |
| 41 | |
| 42 | assert ts_content == py_content, ( |
| 43 | f"Fixture {fixture_name} differs between TypeScript and Python SDKs. " |
| 44 | "Ensure fixtures are kept in sync." |
| 45 | ) |
| 46 | |
| 47 | def test_json_schema_conversion_corpus_is_identical(self) -> None: |
| 48 | """The shared JSON Schema conversion corpus has one copy per language.""" |
| 49 | ts_path = get_ts_json_schema_corpus_dir() / "object-cases.json" |
| 50 | py_path = get_py_json_schema_corpus_dir() / "object-cases.json" |
| 51 | |
| 52 | assert ts_path.read_bytes() == py_path.read_bytes(), ( |
| 53 | "object-cases.json differs between the TypeScript and Python SDKs. " |
| 54 | "Both copies must stay byte-identical." |
| 55 | ) |