testutils

package
v0.0.0-...-93fe8b1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const StubSecret = "some-line-channel-secret"

Variables

This section is empty.

Functions

func AssertHttpStatus

func AssertHttpStatus(t *testing.T) func(rr *httptest.ResponseRecorder, want int)

func GenerateSignature

func GenerateSignature(secret, body string) string

func InitRoutesTest

func InitRoutesTest()

Set test mode for gin

func NewMockHttpClient

func NewMockHttpClient(mockRespCode int, callbacks ...Callback) *http.Client

Types

type Callback

type Callback = func(req *http.Request)

type MockService

type MockService[T any] struct {
	// contains filtered or unexported fields
}

func (*MockService[T]) CalledTimes

func (s *MockService[T]) CalledTimes() int

func (*MockService[T]) Execute

func (s *MockService[T]) Execute(dto *T) error

type MockServiceInterface

type MockServiceInterface[T any] interface {
	Execute(*T) error
	CalledTimes() int
}

func NewMockService

func NewMockService[T any](shouldFail bool, errs ...error) MockServiceInterface[T]

type RoutesTestSuite

type RoutesTestSuite struct {
	Router         *gin.Engine
	ServiceContext *s.ServiceContext
}

func NewRoutesTestSuite

func NewRoutesTestSuite() *RoutesTestSuite

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL