Skip to content

feat!: add httpx + MCP adapters, restructure formats/protocols/http#27

Merged
othercodes merged 2 commits into
masterfrom
feat/mcp-and-httpx-adapter
May 13, 2026
Merged

feat!: add httpx + MCP adapters, restructure formats/protocols/http#27
othercodes merged 2 commits into
masterfrom
feat/mcp-and-httpx-adapter

Conversation

@othercodes
Copy link
Copy Markdown
Owner

Summary

  • Adds httpx adapter (FluentResponse, HttpxRequestBuilder, FluentHttpAssertClient) for FastAPI / Starlette / FastMCP testing
  • Adds MCP protocol support (AssertableMCP, AssertableContent, AssertableToolDef/List/Call, MessageBuilder) with MCP-native vocabulary
  • Restructures packages around concept: pyssertive.formats/ (JSON, HTML), pyssertive.protocols/mcp/ (DSL), pyssertive.http/ (request, response, transport)
  • Migrates ~170 duplicated adapter tests to contract testing pattern (1 parametrized test × N adapters)
  • Adds test-cross-adapter CI job to validate both adapters cumple el mismo contrato

Breaking changes

  • pyssertive.protocol.HttpResponseProtocolpyssertive.http.response.ResponseProtocol
  • pyssertive.request.*pyssertive.http.request.*
  • pyssertive.mcp.* split: pyssertive.protocols.mcp.* (DSL) + pyssertive.http.mcp.* (transport)
  • AssertableMCP(payload) constructor replaces assert_mcp() function (auto-detects dict / bytes / str / SSE / HTTP response)
  • AssertableJson(payload) and AssertableHtml(payload) constructors now accept bytes/str directly (auto-parse)
  • Removed: assert_see, assert_dont_see, assert_see_in_order (use _html / _text variants)
  • Removed: assert_json_is_object, assert_json_is_array (use _dict / _list)
  • Removed: AssertableToolCall.because_message_contains (alias of with_message_containing)

Test plan

  • 859 tests pass locally
  • mypy clean
  • ruff clean
  • 100% coverage
  • CI pipeline green (test-core, test-django, test-httpx, test-cross-adapter, coverage, sonarcloud)

- Add httpx adapter (FluentResponse, RequestBuilder, FluentHttpAssertClient)
- Add MCP protocol support (AssertableMCP, AssertableContent/Tools, MessageBuilder)
- Restructure: pyssertive.formats/ (JSON, HTML), pyssertive.protocols/mcp/ (DSL),
  pyssertive.http/ (request, response, mcp transport, mixins)
- Contract testing: parametrized cross-adapter tests in tests/adapters/test_*.py
- CI: add test-cross-adapter job

BREAKING CHANGES:
- pyssertive.protocol.HttpResponseProtocol -> pyssertive.http.response.ResponseProtocol
- pyssertive.request.* -> pyssertive.http.request.*
- pyssertive.mcp.* split: protocols.mcp.* (DSL) + http.mcp.* (transport)
- AssertableMCP(payload) constructor replaces assert_mcp() function
- Removed: assert_see/dont_see/see_in_order, assert_json_is_object/array,
  AssertableToolCall.because_message_contains (alias)
@othercodes othercodes self-assigned this May 13, 2026
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 13, 2026

@othercodes othercodes merged commit 7fb6e41 into master May 13, 2026
32 checks passed
@othercodes othercodes deleted the feat/mcp-and-httpx-adapter branch May 13, 2026 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant