d71653a056
Replace the A2aHttpTransport stub with a working HTTP(S) transport that: - Connects to remote A2A servers via HTTPS (with configurable TLS verification) - Sends JSON-RPC 2.0 requests over HTTP POST - Parses JSON-RPC responses into A2aResponse objects - Handles HTTP errors (4xx/5xx) with structured error mapping - Supports JWT Bearer token authentication - Validates connection state before send operations Added comprehensive test coverage: - Behave BDD scenarios for validation and lifecycle testing - Pytest unit tests with mocked HTTP responses covering success, errors, network failures, auth tokens, and roundtrip serialization
57 lines
2.4 KiB
Gherkin
57 lines
2.4 KiB
Gherkin
Feature: A2aHttpTransport server-mode HTTP transport
|
|
As an A2A client, I want to communicate with remote agents via HTTP(S)
|
|
using JSON-RPC 2.0 message framing.
|
|
|
|
Scenario Outline: Transport connect accepts valid base URLs
|
|
Given a new A2aHttpTransport
|
|
When I try to connect via the transport to "<url>"
|
|
Then the transport should be connected when using url
|
|
Examples:
|
|
| url |
|
|
| http://localhost:8080 |
|
|
| https://localhost:8443 |
|
|
| http://server.example.com/ |
|
|
| https://a2a.cleverthis.com/api/|
|
|
|
|
Scenario Outline: Transport connect rejects invalid base URLs
|
|
Given a new A2aHttpTransport
|
|
When I try to connect via the transport to "<url>"
|
|
Then an A2aValueError should be raised with message containing "<reason>"
|
|
Examples:
|
|
| url | reason |
|
|
| "" | empty string |
|
|
| "ftp://localhost:8080" | invalid scheme |
|
|
| None | not a non-empty string|
|
|
|
|
Scenario: Transport send requires A2aRequest instance
|
|
Given a new A2aHttpTransport
|
|
When the transport is connected to "http://localhost:8080"
|
|
And I try to send a non-A2aRequest via the transport
|
|
Then an A2aTypeError should be raised for the transport
|
|
|
|
Scenario: Transport send while disconnected raises RuntimeError
|
|
Given a new A2aHttpTransport
|
|
When I try to send a request via the unconnected transport
|
|
Then an A2aRuntimeError should be raised for the transport
|
|
|
|
Scenario: Server response is parsed successfully (mocked)
|
|
Given a new A2aHttpTransport
|
|
When the transport is connected to "http://localhost:8080"
|
|
And HTTP responses are mocked with JSON-RPC success response
|
|
And I send a request <request_method> via the transport
|
|
Then the response has no error
|
|
|
|
Scenario: Server returns HTTP 500 error (mocked)
|
|
Given a new A2aHttpTransport
|
|
When the transport is connected to "http://localhost:8080"
|
|
And HTTP responses are mocked with HTTP 500 status
|
|
And I send a request <request_method> via the transport
|
|
Then the response has an error
|
|
|
|
Scenario: Transport disconnect after connect clears state
|
|
Given a new A2aHttpTransport
|
|
When the transport is connected to "http://localhost:8080"
|
|
Then the transport should be connected when using url
|
|
And I disconnect the transport
|
|
Then the transport should not be connected
|