Module dropshot::test_util [−][src]
Automated testing facilities. These are intended for use both by this crate and dependents of this crate.
Structs
BunyanLogRecord | Represents a Bunyan log record. This form does not support any non-standard fields. "level" is not yet supported because we don't (yet) need it. |
BunyanLogRecordSpec | Analogous to a BunyanLogRecord, but where all fields are optional. |
ClientTestContext | ClientTestContext encapsulates several facilities associated with using an HTTP client for testing. |
LogContext | Constructs a Logger for use by a test suite. If a file-based logger is
requested, the file will be put in a temporary directory and the name will be
unique for a given test name and is likely to be unique across multiple runs
of this test. The file will also be deleted if the test succeeds, indicated
by invoking |
TestContext | TestContext is used to manage a matched server and client for the common test-case pattern of setting up a logger, server, and client and tearing them all down at the end. |
Functions
iter_collection | Iterate a paginated collection. |
log_file_for_test | Returns a unique path name in a temporary directory that includes the given
|
object_get | Fetches a single resource from the API. |
objects_list | Fetches a list of resources from the API. |
objects_list_page | Fetches a page of resources from the API. |
objects_post | Issues an HTTP POST to the specified collection URL to create an object. |
read_bunyan_log | Read a file containing a Bunyan-format log, returning an array of records. |
read_config | Load an object of type |
read_json | Given a Hyper response whose body is expected to be a JSON object that should be parseable via Serde as type T, asynchronously read the body of the response and parse it, returning an instance of T. |
read_ndjson | Given a Hyper Response whose body is expected to represent newline-separated JSON, each line of which is expected to be parseable via Serde as type T, asynchronously read the body of the response and parse it accordingly, returning a vector of T. |
read_string | Given a Hyper Response whose body is expected to be a UTF-8-encoded string, asynchronously read the body. |
verify_bunyan_records | Verify that the key fields of the log records emitted by |
verify_bunyan_records_sequential | Verify that the Bunyan records emitted by |