# PR Description
* Adds/updates the following files to all toolkits:
- `.pre-commit-config.yaml`
- `.ruff.toml`
- `LICENSE`
- `Makefile`
- `pyproject.toml`
* Lint all toolkits such that they pass `make check` and `make test` (a
total doozy). This includes adding some unit tests and evals.
* Github workflow for testing toolkits before merge into main (courtesy
of @sdreyer)
* Added a QOL improvement for tool developers for when they need to get
the context's auth token.
* Minor updates to `arcade new` template.
20 lines
659 B
Python
20 lines
659 B
Python
import pytest
|
|
from arcade.sdk import ToolAuthorizationContext, ToolContext
|
|
|
|
|
|
@pytest.fixture
|
|
def tool_context():
|
|
"""Fixture for the ToolContext with mock authorization."""
|
|
return ToolContext(
|
|
authorization=ToolAuthorizationContext(token="test_token", user_info={"sub": "test_user"}), # noqa: S106
|
|
user_id="test_user",
|
|
)
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_httpx_client(mocker):
|
|
"""Fixture to mock the httpx.AsyncClient."""
|
|
# Mock the AsyncClient context manager
|
|
mock_client = mocker.patch("httpx.AsyncClient", autospec=True)
|
|
async_mock_client = mock_client.return_value.__aenter__.return_value
|
|
return async_mock_client
|