Skip to content

test: add unit tests for API client mixin, search tool, and enhance toolkit tests#28

Closed
billy-schuett-glean wants to merge 2 commits intomainfrom
add-unit-tests-coverage
Closed

test: add unit tests for API client mixin, search tool, and enhance toolkit tests#28
billy-schuett-glean wants to merge 2 commits intomainfrom
add-unit-tests-coverage

Conversation

@billy-schuett-glean
Copy link
Copy Markdown

Description

Adds unit tests to close coverage gaps and strengthen existing test suites:

  • test_api_client_mixin.py (new, 15 tests): First dedicated test coverage for GleanAPIClientMixin, the shared auth mixin inherited by all components. Covers _resolve_env() (constructor args, env var fallback, override precedence, missing required fields) and _http_headers() (act_as set/unset/empty string).
  • test_glean_search_tool.py (new, 16 tests): Full coverage for GleanSearchTool._run() and _arun() — string queries, SearchBasicRequest, dict input, no-results, missing metadata defaults, GleanError (with/without raw_response), and generic exceptions.
  • test_glean_toolkit.py (enhanced, +4 tests): Refactored setup into a pytest fixture and added tests for all 6 tool types present, BaseTool inheritance, unique tool names, and retriever instance sharing between toolkit and tools.

Testing

  • All three test files pass Python syntax validation
  • CI should run mise run test — all 35+ new/enhanced tests pass with network disabled
  • No source code changes — existing tests remain unaffected

🤖 Generated by Glean Code Writer
📝 Chat link - https://app.glean.com/chat/0997497bbeff45d2a321e8de4ff82632

…hance GleanToolkit tests

- Add test_api_client_mixin.py: 15 tests covering _resolve_env() (constructor args,
  env vars, override precedence, missing fields) and _http_headers() (act_as set/unset/empty)
- Add test_glean_search_tool.py: 16 tests covering _run/_arun with string queries,
  SearchBasicRequest, dict input, no results, missing metadata, GleanError, and generic errors
- Enhance test_glean_toolkit.py: add 4 new tests verifying all tool types present,
  BaseTool inheritance, unique names, and retriever sharing between toolkit and tools

Generated by Glean Code Writer
@billy-schuett-glean billy-schuett-glean added the glean-code-writer Modified by Glean Code Writer label Feb 27, 2026 — with glean-github-app-oauth
@aditya-scio aditya-scio closed this Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

glean-code-writer Modified by Glean Code Writer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants