Documentation ¶
Index ¶
Constants ¶
const Password = "password"
Mock server password
const User = "user"
Mock server user name
Variables ¶
This section is empty.
Functions ¶
func UnmarshalSoapAction ¶
UnmarshalSoapAction unmarshals a SOAP body from the given HTTP request and determines the contained action.
In case of an error, the corresponding response status code is automatically written.
func WriteSoapResponse ¶
func WriteSoapResponse(w http.ResponseWriter, out any) error
WriteSoapResponse writes a SOAP response by wrapping the given output object into the necessary SOAP envelope.
In case of an error, the corresponding response status code is automatically written.
Types ¶
type ServiceMock ¶
type ServiceMock struct { // Path sets the URL path used to invoke this service. Path string // HandleFunc provides the actual mock functionality (which is called as // soon the URL path defined is accessed). HandleFunc func(http.ResponseWriter, *http.Request) }
ServiceMock is used to plugin service mocks.
func ServiceMockFromFile ¶ added in v0.1.2
func ServiceMockFromFile(path string, file string) *ServiceMock
ServiceMockFromFile creates a ServiceMock instance sending the given file everytime the associated path is accessed.
type TR064Server ¶
type TR064Server interface { // Server gets the HTTP URL the mock server is listenting on. Server() *url.URL // Server gets the HTTPS URL the mock server is listenting on. SecureServer() *url.URL // Ping checks whether the mock server is up and running (on the HTTP address). Ping() error // Ping checks whether the mock server is up and running (on the HTTPS address). SecurePing() error // Shutdown terminates the mock server gracefully. Shutdown() }
TR064Server interface is used to interact with a mock server instantiated via Start.
func Start ¶
func Start(docsDir string, mocks ...*ServiceMock) TR064Server
Start setup and starts a new mock server.
The mock server establishes a HTTP as well as a HTTPS listener using dynamic ports. Use [Server] and [SecureServer] to get the actual addresses.