Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunOneWith ¶
Run initializes the tester, runs a test, and closes it, calling Fatalf on any error.
func RunTestWith ¶
RunTestWith runs a test using the specified basename and callback. This can be used multiple times within a Tester. The database state is maintained across tests, allowing a sequence of calls that builds up and modifies a database.
Types ¶
type Tester ¶
type Tester struct { goldendb.Tester CreateHandler func(r *Tester) http.Handler Callback func() (*http.Request, error) }
Tester provides the structure for running API unit tests. For a single test, the typical calling sequence is:
r := NewTester(handlerCreateFunc) r.Run(t, basename, callback)
For multiple tests, maintaining the Tester state across tests as it changes:
r := NewTester(handlerCreateFunc) r.Init() r.RunTestWith(t, basename, callback) r.RunTestWith(t, basename2, callback2) r.Close()
func NewTester ¶
NewTester creates a new instance of a Tester that will use the specified function to create an http.Handler.
type TesterApi ¶
type TesterApi interface { goldenbase.MultiRunner SetBaseNameAndCallback(basename string, callback func() (*http.Request, error)) }
Click to show internal directories.
Click to hide internal directories.