Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
test(python-sdk): drop build API path encoding integration tests (#1713)
cursor[bot]d55ddb8b5c54
diff --git a/packages/python-sdk/tests/shared/template/test_build_api_path_encoding.py b/packages/python-sdk/tests/shared/template/test_build_api_path_encoding.pydeleted file mode 100644index 2eb600c37..000000000--- a/packages/python-sdk/tests/shared/template/test_build_api_path_encoding.py+++ /dev/null@@ -1,112 +0,0 @@-import httpx--from e2b.api.client.client import AuthenticatedClient-from e2b.sandbox_async.sandbox_api import SandboxApi as AsyncSandboxApi-from e2b.sandbox_sync.sandbox_api import SandboxApi as SyncSandboxApi-from e2b.template_async import build_api as async_build_api-from e2b.template_sync import build_api as sync_build_api--NAMESPACED = "my-team/my-template"-NAMESPACED_SNAPSHOT = "team-slug/my-snapshot:default"-BASE_URL = "https://api.e2b.dev"---def _handler(request: httpx.Request) -> httpx.Response:- if request.method == "DELETE":- return httpx.Response(200, json={})- if request.url.path.endswith("/tags"):- return httpx.Response(200, json=[])- return httpx.Response(404, json={"code": 404, "message": "not found"})---def _recording_client() -> tuple[AuthenticatedClient, list[httpx.Request]]:- """Client whose requests are answered locally and recorded for assertions."""- requests: list[httpx.Request] = []-- def record(request: httpx.Request) -> httpx.Response:- requests.append(request)- return _handler(request)-- transport = httpx.MockTransport(record)- client = AuthenticatedClient(base_url=BASE_URL, token="e2b_test")- client.set_httpx_client(httpx.Client(base_url=BASE_URL, transport=transport))- client.set_async_httpx_client(- httpx.AsyncClient(base_url=BASE_URL, transport=transport)- )- return client, requests---def test_sync_alias_check_sends_encoded_alias():- client, requests = _recording_client()-- assert sync_build_api.check_alias_exists(client, NAMESPACED) is False-- # raw_path is what goes on the wire: the slash stays encoded, so the whole- # alias remains a single path segment instead of splitting the route.- assert requests[0].url.raw_path == b"/templates/aliases/my-team%2Fmy-template"---def test_sync_alias_check_leaves_plain_alias_untouched():- client, requests = _recording_client()-- assert sync_build_api.check_alias_exists(client, "my-template") is False-- assert requests[0].url.raw_path == b"/templates/aliases/my-template"---def test_sync_get_template_tags_sends_encoded_template_id():- client, requests = _recording_client()-- assert sync_build_api.get_template_tags(client, NAMESPACED) == []-- assert requests[0].url.raw_path == b"/templates/my-team%2Fmy-template/tags"---async def test_async_alias_check_sends_encoded_alias():- client, requests = _recording_client()-- assert await async_build_api.check_alias_exists(client, NAMESPACED) is False-- assert requests[0].url.raw_path == b"/templates/aliases/my-team%2Fmy-template"---async def test_async_alias_check_leaves_plain_alias_untouched():- client, requests = _recording_client()-- assert await async_build_api.check_alias_exists(client, "my-template") is False-- assert requests[0].url.raw_path == b"/templates/aliases/my-template"---async def test_async_get_template_tags_sends_encoded_template_id():- client, requests = _recording_client()-- assert await async_build_api.get_template_tags(client, NAMESPACED) == []-- assert requests[0].url.raw_path == b"/templates/my-team%2Fmy-template/tags"---def test_sync_delete_snapshot_sends_encoded_snapshot_id(monkeypatch):- client, requests = _recording_client()- monkeypatch.setattr(- "e2b.sandbox_sync.sandbox_api.get_api_client", lambda config: client- )-- assert SyncSandboxApi._cls_delete_snapshot(NAMESPACED_SNAPSHOT, api_key="e2b_test")-- # Snapshot IDs carry both a namespace slash and a `:tag`; both must stay- # encoded so DELETE /templates/{id} targets one path segment.- assert requests[0].url.raw_path == b"/templates/team-slug%2Fmy-snapshot%3Adefault"---async def test_async_delete_snapshot_sends_encoded_snapshot_id(monkeypatch):- client, requests = _recording_client()- monkeypatch.setattr(- "e2b.sandbox_async.sandbox_api.get_api_client", lambda config: client- )-- assert await AsyncSandboxApi._cls_delete_snapshot(- NAMESPACED_SNAPSHOT, api_key="e2b_test"- )-- assert requests[0].url.raw_path == b"/templates/team-slug%2Fmy-snapshot%3Adefault"