Versions in this module Expand all Collapse all v1 v1.1.0 Jul 24, 2022 v1.0.0 Jul 22, 2022 Changes in this version + func NewStdoutNotifier() core.T + func Noop() core.T + type Cleanable interface + Cleanup func(func()) + type Config struct + Addr string + BodyParsers []RequestBodyParser + CORS cors.Config + Context context.Context + LogVerbosity LogVerbosity + Middlewares []func(http.Handler) http.Handler + Server Server + type Configurer struct + func Configure() *Configurer + func (cb *Configurer) Addr(addr string) *Configurer + func (cb *Configurer) Build() Config + func (cb *Configurer) CORS(options ...cors.Config) *Configurer + func (cb *Configurer) Context(context context.Context) *Configurer + func (cb *Configurer) LogVerbosity(l LogVerbosity) *Configurer + func (cb *Configurer) Middlewares(fn ...func(handler http.Handler) http.Handler) *Configurer + func (cb *Configurer) RequestBodyParsers(bp ...RequestBodyParser) *Configurer + func (cb *Configurer) Server(srv Server) *Configurer + type LogVerbosity int + const LogSilently + const LogVerbose + type Mocha struct + func New(t core.T, config ...Config) *Mocha + func NewBasic() *Mocha + func (m *Mocha) AddMocks(builders ...*MockBuilder) *Scoped + func (m *Mocha) AssertCalled(t core.T) bool + func (m *Mocha) AssertHits(t core.T, expected int) bool + func (m *Mocha) AssertNotCalled(t core.T) bool + func (m *Mocha) Close() error + func (m *Mocha) CloseOnCleanup(t Cleanable) *Mocha + func (m *Mocha) Disable() + func (m *Mocha) Enable() + func (m *Mocha) Hits() int + func (m *Mocha) Parameters() parameters.Params + func (m *Mocha) Start() ServerInfo + func (m *Mocha) StartTLS() ServerInfo + func (m *Mocha) Subscribe(evt events.Events) + func (m *Mocha) URL() string + type MockBuilder struct + func Delete(m expect.Matcher) *MockBuilder + func Get(m expect.Matcher) *MockBuilder + func Head(m expect.Matcher) *MockBuilder + func Options(m expect.Matcher) *MockBuilder + func Patch(u expect.Matcher) *MockBuilder + func Post(m expect.Matcher) *MockBuilder + func Put(m expect.Matcher) *MockBuilder + func Request() *MockBuilder + func (b *MockBuilder) Body(matcherList ...expect.Matcher) *MockBuilder + func (b *MockBuilder) Build() *core.Mock + func (b *MockBuilder) FormField(field string, m expect.Matcher) *MockBuilder + func (b *MockBuilder) Header(key string, m expect.Matcher) *MockBuilder + func (b *MockBuilder) MatchAfter(m expect.Matcher) *MockBuilder + func (b *MockBuilder) Method(method string) *MockBuilder + func (b *MockBuilder) Name(name string) *MockBuilder + func (b *MockBuilder) PostAction(action core.PostAction) *MockBuilder + func (b *MockBuilder) Priority(p int) *MockBuilder + func (b *MockBuilder) Query(key string, m expect.Matcher) *MockBuilder + func (b *MockBuilder) Repeat(times int) *MockBuilder + func (b *MockBuilder) Reply(rep core.Reply) *MockBuilder + func (b *MockBuilder) ReplyFunction(fn func(*http.Request, *core.Mock, parameters.Params) (*core.Response, error)) *MockBuilder + func (b *MockBuilder) ReplyJust(status int, r ...reply.StdReply) *MockBuilder + func (b *MockBuilder) RequestMatches(m expect.Matcher) *MockBuilder + func (b *MockBuilder) ScenarioIs(scenario string) *MockBuilder + func (b *MockBuilder) ScenarioStateIs(requiredState string) *MockBuilder + func (b *MockBuilder) ScenarioStateWillBe(newState string) *MockBuilder + func (b *MockBuilder) StartScenario(name string) *MockBuilder + func (b *MockBuilder) URL(m expect.Matcher) *MockBuilder + type RequestBodyParser interface + CanParse func(contentType string, r *http.Request) bool + Parse func(body []byte, r *http.Request) (any, error) + type Scoped struct + func (s *Scoped) AssertCalled(t core.T) bool + func (s *Scoped) AssertNotCalled(t core.T) bool + func (s *Scoped) Called() bool + func (s *Scoped) Clean() + func (s *Scoped) Disable() + func (s *Scoped) Enable() + func (s *Scoped) Get(id int) *core.Mock + func (s *Scoped) Hits() int + func (s *Scoped) IsPending() bool + func (s *Scoped) ListAll() []*core.Mock + func (s *Scoped) ListCalled() []*core.Mock + func (s *Scoped) ListPending() []*core.Mock + type Server interface + Close func() error + Configure func(Config, http.Handler) error + Info func() ServerInfo + Start func() (ServerInfo, error) + StartTLS func() (ServerInfo, error) + type ServerInfo struct + URL string + type StdoutNotifier struct + func (n *StdoutNotifier) Errorf(format string, args ...any) + func (n *StdoutNotifier) FailNow() + func (n *StdoutNotifier) Helper() + func (n *StdoutNotifier) Logf(format string, args ...any) Other modules containing this package github.com/vitorsalgado/mocha/v2 github.com/vitorsalgado/mocha/v3