Extracted scenario

This commit is contained in:
Artyom Belousov 2021-06-06 11:00:50 +03:00
parent c02435ccaa
commit cc2058090c
13 changed files with 235 additions and 173 deletions

View file

@ -3,37 +3,26 @@ package vk
import (
"bytes"
"encoding/json"
"github.com/gin-gonic/gin"
"log"
"net/http/httptest"
"github.com/gin-gonic/gin"
"gitlab.com/flygrounder/go-mtg-vk/internal/scenario"
)
type testCtx struct {
handler *Handler
recorder *httptest.ResponseRecorder
sender *testSender
logBuf *bytes.Buffer
}
func getTestHandlerCtx() testCtx {
sender := &testSender{}
buf := &bytes.Buffer{}
s := scenario.GetTestScenarioCtx()
return testCtx{
logBuf: buf,
handler: &Handler{
SecretKey: "sec",
GroupId: 10,
ConfirmationString: "con",
Sender: sender,
Logger: log.New(buf, "", 0),
InfoFetcher: &testInfoFetcher{},
Cache: &testCache{
table: map[string]string{
"good": "good",
},
},
Scenario: s.Scenario,
},
sender: sender,
recorder: httptest.NewRecorder(),
}
}