Skip to main content

Module test

Module test 

Source
Expand description

Various helpers for ntex applications to use during testing.

Structs§

TestRequest
Test Request builder.
TestServer
Test server controller
TestServerConfig
Test server configuration

Functions§

call_service
Calls service and waits for response future completion.
config
Create default test server config
default_service
Create service that responds with response with specified status code
from_request
Helper method for extractors testing
init_service
This method accepts application builder instance, and constructs service.
init_service_st
This method accepts application builder instance, and constructs service with specified state.
load_stream
Reads response’s body and combines it to a Bytes objects
ok_service
Create service that always responds with HttpResponse::Ok()
read_body
Helper function that returns a response body of a WebResponse
read_response
Helper function that returns a response body of a TestRequest
read_response_json
Helper function that returns a deserialized response body of a TestRequest
respond_to
Helper method for responders testing
server
Start test server with default configuration
server_with
Start test server with custom configuration