MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / SetUpTestRequest

Function SetUpTestRequest

api/ledger_api_test.go:52–66  ·  view source on GitHub ↗
(s TestRequest)

Source from the content-addressed store, hash-verified

50}
51
52func SetUpTestRequest(s TestRequest) (*httptest.ResponseRecorder, error) {
53 req := httptest.NewRequest(s.Method, s.Route, s.Payload)
54 for key, value := range s.Header {
55 req.Header.Set(key, value)
56 }
57 req.Header.Set("Content-Type", "application/json")
58 resp := httptest.NewRecorder()
59 s.Router.ServeHTTP(resp, req)
60
61 err := json.NewDecoder(resp.Body).Decode(&s.Response)
62 if err != nil {
63 return nil, err
64 }
65 return resp, nil
66}
67
68func setupRouter(t *testing.T) (*gin.Engine, *ledgerforge.LedgerForge, error) {
69 t.Helper()

Callers 15

TestCreateLedgerFunction · 0.85
TestGetLedgerFunction · 0.85
TestCreateAccountFunction · 0.85
TestGetAccountFunction · 0.85
TestGetAllAccountsFunction · 0.85
TestGenerateMockAccountFunction · 0.85
TestCreateBalanceFunction · 0.85
TestGetBalanceFunction · 0.85
TestGetBalancesFunction · 0.85
TestCreateBalanceMonitorFunction · 0.85
TestGetBalanceMonitorFunction · 0.85

Calls 1

SetMethod · 0.65

Tested by

no test coverage detected