Skip to content

Commit

Permalink
fix(internal): update custom code related tests
Browse files Browse the repository at this point in the history
  • Loading branch information
David Meadows committed Sep 25, 2024
1 parent 5aff0ca commit b7287e4
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion tests/api_resources/test_access_tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,44 @@
from __future__ import annotations

import os
from typing import Any, cast
from typing import TYPE_CHECKING, Any, Iterator, AsyncIterator, cast

import pytest

from finch import Finch, AsyncFinch
from finch.types import CreateAccessTokenResponse
from tests.utils import assert_matches_type

if TYPE_CHECKING:
from _pytest.fixtures import FixtureRequest

base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
client_id = "00000000-0000-0000-0000-000000000000"
client_secret = "TEST"


@pytest.fixture(scope="module")
def client(request: FixtureRequest) -> Iterator[Finch]:
strict = getattr(request, "param", True)
if not isinstance(strict, bool):
raise TypeError(f"Unexpected fixture parameter type {type(strict)}, expected {bool}")

with Finch(
base_url=base_url, client_id=client_id, client_secret=client_secret, _strict_response_validation=strict
) as client:
yield client


@pytest.fixture(scope="module")
async def async_client(request: FixtureRequest) -> AsyncIterator[AsyncFinch]:
strict = getattr(request, "param", True)
if not isinstance(strict, bool):
raise TypeError(f"Unexpected fixture parameter type {type(strict)}, expected {bool}")

async with AsyncFinch(
base_url=base_url, client_id=client_id, client_secret=client_secret, _strict_response_validation=strict
) as client:
yield client


class TestAccessTokens:
Expand Down

0 comments on commit b7287e4

Please sign in to comment.