Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type TestServer ¶
TestServer implements the basic interactions with Minitel for the purposes of testing. Use ExpectNotify and ExpectFollowup to register http.Responses with the handler for controlled testing of responses. Or call those methods with nil to get a generic response. The ExpectDone() method can be used to ensure that all expectations have happened within the provided timeout, which is useful for when the client is used async.
func NewServer ¶
func NewServer() *TestServer
NewServer returns a prepared TestServer which should be used like a httptest.Server
ts := NewServer() defer ts.Close()
func (*TestServer) ExpectDone ¶
func (ts *TestServer) ExpectDone(max time.Duration) bool
ExpectDone waits up to max duration for all notify and followup responses to be sent. Returns true if they have been sent. If they haven't been sent after the max duration then return false.
func (*TestServer) ExpectFollowup ¶
func (ts *TestServer) ExpectFollowup(r ...*http.Response)
ExpectFollowup and send the supplied responses. If the responses are nil an empty response with a random ID and a http.StatusCreated is sent
func (*TestServer) ExpectNotify ¶
func (ts *TestServer) ExpectNotify(r ...*http.Response)
ExpectNotify and send the supplied responses. If the responses are nil an empty response with a random ID and a http.StatusCreated is sent