mirror of
https://github.com/joohoi/acme-dns.git
synced 2025-07-20 12:47:53 +07:00
37 lines
626 B
Go
37 lines
626 B
Go
package httpexpect
|
|
|
|
import (
|
|
"net/http"
|
|
"testing"
|
|
)
|
|
|
|
type mockClient struct {
|
|
req *http.Request
|
|
resp http.Response
|
|
err error
|
|
}
|
|
|
|
func (c *mockClient) Do(req *http.Request) (*http.Response, error) {
|
|
c.req = req
|
|
if c.err == nil {
|
|
c.resp.Header = c.req.Header
|
|
c.resp.Body = c.req.Body
|
|
return &c.resp, nil
|
|
}
|
|
return nil, c.err
|
|
}
|
|
|
|
type mockReporter struct {
|
|
testing *testing.T
|
|
reported bool
|
|
}
|
|
|
|
func newMockReporter(t *testing.T) *mockReporter {
|
|
return &mockReporter{t, false}
|
|
}
|
|
|
|
func (r *mockReporter) Errorf(message string, args ...interface{}) {
|
|
r.testing.Logf("Fail: "+message, args...)
|
|
r.reported = true
|
|
}
|