Add mock HTTP server tests for request actors#100
Merged
SeanTAllen merged 1 commit intomainfrom Mar 3, 2026
Merged
Conversation
The request actors (JsonRequester, NoContentRequester, CheckRequester, LinkedJsonRequester) were the largest untested area. Testing them requires a mock HTTPS server since they make real connections via courier/lori. Adds an optional `ssl_ctx` field to `Credentials` so request actors can use a custom SSL context instead of the default system CA store. This allows tests to use self-signed certificates. The field defaults to None, preserving existing behavior for all callers. The mock server follows lori's own SSL test pattern: a TCPListenerActor that accepts connections and dispatches to ssl_server connection actors, with a responder lambda that generates HTTP responses from raw requests. 13 tests cover all four request actor types: - JsonRequester: GET success, GET failure, POST success, GET redirect, GET parse error - NoContentRequester: DELETE success, DELETE failure - CheckRequester: 204 (true), 404 (false), other status (failure) - LinkedJsonRequester: with Link header, without Link header, failure Design: #98
7b51f98 to
b63e6d0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The request actors were the largest untested area in the library. They make real HTTPS connections via courier/lori, so testing them requires a mock HTTP server with SSL support.
This adds an optional
ssl_ctxfield toCredentialsthat lets request actors use a custom SSL context instead of the hardcodedSSLContextFactory. Defaults toNone, so existing callers are unaffected. The mock server follows lori's own SSL test pattern: aTCPListenerActorthat accepts connections and dispatches tossl_serverconnection actors, with a responder lambda that generates HTTP responses.13 tests cover all four request actor types:
JsonRequester(GET success/failure, POST success, redirect following, parse error),NoContentRequester(DELETE success/failure),CheckRequester(204/404/other), andLinkedJsonRequester(with/without Link header, failure).Design: #98