Documentation
¶
Index ¶
- func CreateMultipartFileHeader(filename string, body []byte) *multipart.FileHeader
- func RunCase(t *testing.T, c TestCase, handler http.Handler)
- type Builder
- func (b *Builder) AddField(fieldName, value string) *Builder
- func (b *Builder) AddFile(fieldName, filePath string) *Builder
- func (b *Builder) AddReader(fieldName, fileName string, reader io.Reader) *Builder
- func (b *Builder) Build() (string, io.ReadCloser)
- func (b *Builder) BuildEventFuncRequest() (r *http.Request)
- func (b *Builder) Event(evt Event) *Builder
- func (b *Builder) EventFunc(id string) *Builder
- func (b *Builder) PageURL(url string) *Builder
- func (b *Builder) Queries(v url.Values) *Builder
- func (b *Builder) Query(key string, value string) *Builder
- type Event
- type EventFuncID
- type TestCase
- type TestEventResponse
- type TestLocationBuilder
- type TestPortalUpdate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateMultipartFileHeader ¶
func CreateMultipartFileHeader(filename string, body []byte) *multipart.FileHeader
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder is a multipart builder. It is not thread-safe.
func NewMultipartBuilder ¶
func NewMultipartBuilder() *Builder
New constructs new multipart Builder.
func (*Builder) Build ¶
func (b *Builder) Build() (string, io.ReadCloser)
Build finalizes Builder, returning Content-Type and multipart reader. It should be called only once for Builder. Returned reader should be used (Read/Close) at least once to clean up properly. Any errors are bound to returned reader (will be returned on Read/Close).
func (*Builder) BuildEventFuncRequest ¶
type EventFuncID ¶
type TestCase ¶
type TestCase struct {
Name string
HandlerMaker func() http.Handler
ReqFunc func() *http.Request
EventResponseMatch func(t *testing.T, er *TestEventResponse)
PageMatch func(t *testing.T, body *bytes.Buffer)
ResponseMatch func(t *testing.T, w *httptest.ResponseRecorder)
Debug bool
ExpectPageBodyContainsInOrder []string
ExpectPortalUpdate0ContainsInOrder []string
ExpectPageBodyNotContains []string
ExpectPortalUpdate0NotContains []string
ExpectRunScriptContainsInOrder []string
}
type TestEventResponse ¶
type TestEventResponse struct {
PageTitle string `json:"pageTitle,omitempty"`
Body string `json:"body,omitempty"`
Reload bool `json:"reload,omitempty"`
PushState *TestLocationBuilder `json:"pushState"`
RedirectURL string `json:"redirectURL,omitempty"`
ReloadPortals []string `json:"reloadPortals,omitempty"`
UpdatePortals []*TestPortalUpdate `json:"updatePortals,omitempty"`
Data interface{} `json:"data,omitempty"`
RunScript string `json:"runScript,omitempty"`
}
type TestLocationBuilder ¶
type TestPortalUpdate ¶
Click to show internal directories.
Click to hide internal directories.