diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7db1091..4dd36af 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -38,4 +38,4 @@ jobs: - name: Test run: | - fern test --command "poetry run pytest -rP ." + poetry run pytest . diff --git a/pyproject.toml b/pyproject.toml index 869be6e..5637ccd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "fern-api" -version = "0.0.83" +version = "0.0.0-rc1" description = "" readme = "README.md" authors = [] diff --git a/src/fern/core/client_wrapper.py b/src/fern/core/client_wrapper.py index 23e1937..6e6ad5a 100644 --- a/src/fern/core/client_wrapper.py +++ b/src/fern/core/client_wrapper.py @@ -16,7 +16,7 @@ def get_headers(self) -> typing.Dict[str, str]: headers: typing.Dict[str, str] = { "X-Fern-Language": "Python", "X-Fern-SDK-Name": "fern-api", - "X-Fern-SDK-Version": "0.0.83", + "X-Fern-SDK-Version": "0.0.0-rc1", } headers["Authorization"] = f"Bearer {self._get_token()}" return headers diff --git a/tests/__init__.py b/tests/__init__.py deleted file mode 100644 index f3ea265..0000000 --- a/tests/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - diff --git a/tests/conftest.py b/tests/conftest.py deleted file mode 100644 index 736f31a..0000000 --- a/tests/conftest.py +++ /dev/null @@ -1,16 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import os - -import pytest -from fern.client import AsyncFern, Fern - - -@pytest.fixture -def client() -> Fern: - return Fern(token=os.getenv("ENV_TOKEN", "token"), base_url=os.getenv("TESTS_BASE_URL", "base_url")) - - -@pytest.fixture -def async_client() -> AsyncFern: - return AsyncFern(token=os.getenv("ENV_TOKEN", "token"), base_url=os.getenv("TESTS_BASE_URL", "base_url")) diff --git a/tests/test_snippets.py b/tests/test_snippets.py deleted file mode 100644 index 9d11c8a..0000000 --- a/tests/test_snippets.py +++ /dev/null @@ -1,83 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from fern.client import AsyncFern, Fern - -from fern import EndpointIdentifier, EndpointMethod, Sdk_Python - -from .utilities import validate_response - - -async def test_get(client: Fern, async_client: AsyncFern) -> None: - expected_response = [ - { - "type": "python", - "sdk": {"package": "vellum-ai", "version": "1.2.1"}, - "sync_client": 'import Vellum from vellum.client\n\nclient = Vellum(api_key="YOUR_API_KEY")\nclient.search(query="Find documents written in the last 5 days")\n', - "async_client": 'import VellumAsync from vellum.client\n\nclient = VellumAsync(api_key="YOUR_API_KEY")\nawait client.search(query="Find documents written in the last 5 days")\n', - }, - { - "type": "typescript", - "sdk": {"package": "vellum-ai", "version": "1.2.1"}, - "client": 'import { VellumClient } from "vellum-ai";\n\nconst vellum = VellumClient({\n apiKey="YOUR_API_KEY"\n})\nvellum.search({\n query: "Find documents written in the last 5 days"\n})\n', - }, - ] - response = client.snippets.get(endpoint=EndpointIdentifier(method=EndpointMethod.GET, path="/v1/search")) - validate_response(response, expected_response) - - async_response = await async_client.snippets.get( - endpoint=EndpointIdentifier(method=EndpointMethod.GET, path="/v1/search") - ) - validate_response(async_response, expected_response) - - -async def test_load(client: Fern, async_client: AsyncFern) -> None: - expected_response = { - "next": 2, - "snippets": { - "/v1/search": { - "GET": [ - { - "type": "python", - "sdk": {"package": "vellum-ai", "version": "1.2.1"}, - "sync_client": 'import Vellum from vellum.client\n\nclient = Vellum(api_key="YOUR_API_KEY")\nclient.search(query="Find documents written in the last 5 days")\n', - "async_client": 'import Vellum from vellum.client\n\nclient = Vellum(api_key="YOUR_API_KEY")\nclient.search(query="Find documents written in the last 5 days")\n', - }, - { - "type": "typescript", - "sdk": {"package": "vellum-ai", "version": "1.2.1"}, - "client": 'import { VellumClient } from "vellum-ai";\n\nconst vellum = VellumClient({\n apiKey="YOUR_API_KEY"\n})\nvellum.search({\n query: "Find documents written in the last 5 days"\n})\n', - }, - ] - }, - "v1/document-indexes": { - "POST": [ - { - "type": "python", - "sdk": {"package": "vellum-ai", "version": "1.2.1"}, - "sync_client": 'import Vellum from vellum.client\n\nclient = Vellum(api_key="YOUR_API_KEY")\nclient.document_indexes.create(name="meeting-reports", status="ACTIVE")\n', - "async_client": 'import VellumAsync from vellum.client\n\nclient = VellumAsync(api_key="YOUR_API_KEY")\nawait client.document_indexes.create(name="meeting-reports", status="ACTIVE")\n', - }, - { - "type": "typescript", - "sdk": {"package": "vellum-ai", "version": "1.2.1"}, - "client": 'import { VellumClient } from "vellum-ai";\n\nconst vellum = VellumClient({\n apiKey="YOUR_API_KEY"\n})\nvellum.documentIndexes.create({\n name: "meeting-reports",\n status: "ACTIVE"\n})\n', - }, - ] - }, - }, - } - response = client.snippets.load( - page=1, - org_id="vellum", - api_id="vellum-ai", - sdks=[Sdk_Python(type="python", package="vellum-ai", version="1.2.1")], - ) - validate_response(response, expected_response) - - async_response = await async_client.snippets.load( - page=1, - org_id="vellum", - api_id="vellum-ai", - sdks=[Sdk_Python(type="python", package="vellum-ai", version="1.2.1")], - ) - validate_response(async_response, expected_response) diff --git a/tests/utilities.py b/tests/utilities.py deleted file mode 100644 index e59d044..0000000 --- a/tests/utilities.py +++ /dev/null @@ -1,32 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import json -import typing - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - - -def validate_response(response: typing.Any, json_expectation: typing.Any) -> None: - if not isinstance(response, dict) and not issubclass(type(response), pydantic.BaseModel): - assert response == json_expectation, "Primitives found, expected: {0}, Actual: {1}".format( - json_expectation, response - ) - return - - response_json = response - if issubclass(type(response), pydantic.BaseModel): - response_json = json.loads(response.json()) - - for key, value in json_expectation.items(): - assert key in response_json - if isinstance(value, dict): - validate_response(response_json[key], value) - else: - assert response_json[key] == value - - # Ensure there are no additional fields here either - del response_json[key] - assert len(response_json) == 0, "Additional fields found, expected None: {0}".format(response_json)