-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcontext_test.go
52 lines (39 loc) · 1.04 KB
/
context_test.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
46
47
48
49
50
51
52
// Copyright (C) 2012 Numerotron Inc.
// Use of this source code is governed by an MIT-style license
// that can be found in the LICENSE file.
package bingo
import (
"net/http"
"net/http/httptest"
)
type testContext struct {
recorder *httptest.ResponseRecorder
}
func newTestContext() *testContext {
result := new(testContext)
result.recorder = httptest.NewRecorder()
return result
}
func (tc *testContext) Session() *Session {
return nil
}
func (tc *testContext) Request() *http.Request {
return nil
}
func (tc *testContext) Writer() http.ResponseWriter {
return tc.recorder
}
func (tc *testContext) body() string {
return string(tc.recorder.Body.Bytes())
}
func (tc *testContext) contentType() string {
return tc.recorder.HeaderMap.Get("Content-Type")
}
func (tc *testContext) contentDisposition() string {
return tc.recorder.HeaderMap.Get("Content-Disposition")
}
func (tc *testContext) Before() (bool, error) { return true, nil }
func (tc *testContext) After() {}
func (tc *testContext) ResultData(title string) TemplateData {
return nil
}