# 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.
24 lines
780 B
Python
24 lines
780 B
Python
from arcade.core.schema import ToolAuthorizationContext, ToolContext
|
|
|
|
|
|
def test_get_auth_token_or_empty_with_token():
|
|
expected_token = "test_token" # noqa: S105
|
|
auth_context = ToolAuthorizationContext(token=expected_token)
|
|
tool_context = ToolContext(authorization=auth_context)
|
|
|
|
actual_token = tool_context.get_auth_token_or_empty()
|
|
|
|
assert actual_token == expected_token
|
|
|
|
|
|
def test_get_auth_token_or_empty_without_token():
|
|
auth_context = ToolAuthorizationContext(token=None)
|
|
tool_context = ToolContext(authorization=auth_context)
|
|
|
|
assert tool_context.get_auth_token_or_empty() == ""
|
|
|
|
|
|
def test_get_auth_token_or_empty_no_authorization():
|
|
tool_context = ToolContext(authorization=None)
|
|
|
|
assert tool_context.get_auth_token_or_empty() == ""
|