Skip to content

test: add unit tests for server utility functions - #4

Open
mvanhorn wants to merge 1 commit into
xdevplatform:masterfrom
mvanhorn:test/server-utility-tests
Open

test: add unit tests for server utility functions#4
mvanhorn wants to merge 1 commit into
xdevplatform:masterfrom
mvanhorn:test/server-utility-tests

Conversation

@mvanhorn

@mvanhorn mvanhorn commented Apr 6, 2026

Copy link
Copy Markdown

Summary

Adds 44 pytest tests covering the 6 utility functions in server.py that
had zero test coverage. All tests run offline without API keys or network
access.

Functions covered

Function Tests What's verified
is_truthy 15 All truthy/falsy values, None, whitespace
parse_csv_env 6 Empty, blank, single, multiple, whitespace stripping, empty items
should_join_query_param 6 Query/non-query, array/non-array, explode variations
collect_comma_params 4 From components, from paths, $ref skipping, empty spec
should_exclude_operation 7 Webhook/stream paths, tags, x-twitter-streaming flag
filter_openapi_spec 6 Allowlist, denylist, tag filter, no filters, non-method keys

Testing

$ python -m pytest test_server.py -v
44 passed in 0.98s

The existing test_grok_mcp.py is a Grok client script (not a test suite).
This PR adds actual pytest-based tests for the server module.

This contribution was developed with AI assistance (Claude Code).

Covers is_truthy, parse_csv_env, should_join_query_param,
collect_comma_params, should_exclude_operation, and
filter_openapi_spec. All tests run offline without API keys.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant