@@ -15,8 +15,8 @@ const name = "Shawn Ding"
15
15
16
16
const password = "passwordfortest"
17
17
18
- func InitTestApp () * golf.Application {
19
- app : = Initialize ()
18
+ func InitTestApp (app * golf. Application ) * golf.Application {
19
+ app = Initialize (app )
20
20
21
21
app .View .SetTemplateLoader ("base" , "view" )
22
22
app .View .SetTemplateLoader ("admin" , filepath .Join (".." , ".." , "view" , "admin" ))
@@ -34,7 +34,8 @@ func makeTestHTTPRequest(body io.Reader, method, url string) *http.Request {
34
34
35
35
func mockSignUpPostRequest (email , name , password , rePassword string ) * golf.Context {
36
36
w := httptest .NewRecorder ()
37
- Initialize ()
37
+ app := golf .New ()
38
+ app = Initialize (app )
38
39
39
40
form := url.Values {}
40
41
form .Add ("email" , email )
@@ -49,7 +50,8 @@ func mockSignUpPostRequest(email, name, password, rePassword string) *golf.Conte
49
50
50
51
func mockContext (form url.Values , method , path string ) * golf.Context {
51
52
w := httptest .NewRecorder ()
52
- Initialize ()
53
+ app := golf .New ()
54
+ app = Initialize (app )
53
55
54
56
r := makeTestHTTPRequest (strings .NewReader (form .Encode ()), method , path )
55
57
r .PostForm = form
@@ -58,7 +60,8 @@ func mockContext(form url.Values, method, path string) *golf.Context {
58
60
59
61
func mockLogInPostContext () * golf.Context {
60
62
w := httptest .NewRecorder ()
61
- Initialize ()
63
+ app := golf .New ()
64
+ app = Initialize (app )
62
65
63
66
form := url.Values {}
64
67
form .Add ("email" , email )
0 commit comments