-
-
Notifications
You must be signed in to change notification settings - Fork 517
/
suite.go
45 lines (36 loc) · 855 Bytes
/
suite.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package itest
import (
"context"
"github.com/stretchr/testify/suite"
)
type TestingSuite interface {
suite.TestingSuite
Harness
AmendSuiteContext(context.Context) context.Context
Context() context.Context
Assert() *Assertions
Require() *Requirements
SuiteName() string
setContext(ctx context.Context)
}
type Suite struct {
suite.Suite
Harness
ctx context.Context
}
func (s *Suite) AmendSuiteContext(ctx context.Context) context.Context {
return ctx
}
//nolint:unused // Linter is confused about this one.
func (s *Suite) setContext(ctx context.Context) {
s.ctx = ctx
}
func (s *Suite) Context() context.Context {
return WithT(s.ctx, s.T())
}
func (s *Suite) Assert() *Assertions {
return &Assertions{Assertions: s.Suite.Assert()}
}
func (s *Suite) Require() *Requirements {
return &Requirements{Assertions: s.Suite.Require()}
}