ch14.5
This commit is contained in:
@@ -8,12 +8,33 @@ import (
|
||||
"net/http/cookiejar"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"gitea.local.lab/Lbenedar/snippetbox/internal/models/mocks"
|
||||
"github.com/alexedwards/scs/v2"
|
||||
"github.com/go-playground/form/v4"
|
||||
)
|
||||
|
||||
func newTestApplication(t *testing.T) *application {
|
||||
templateCache, err := newTemplateCache()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
formDecoder := form.NewDecoder()
|
||||
|
||||
sessionManager := scs.New()
|
||||
sessionManager.Lifetime = 12 * time.Hour
|
||||
sessionManager.Cookie.Secure = true
|
||||
|
||||
return &application{
|
||||
errorLog: log.New(io.Discard, "", 0),
|
||||
infoLog: log.New(io.Discard, "", 0),
|
||||
errorLog: log.New(io.Discard, "", 0),
|
||||
infoLog: log.New(io.Discard, "", 0),
|
||||
snippets: &mocks.SnippetModel{},
|
||||
users: &mocks.UserModel{},
|
||||
templateCache: templateCache,
|
||||
formDecoder: formDecoder,
|
||||
sessionManager: sessionManager,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user