testutils

package
v0.0.0-...-c3cdbdc Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2025 License: MIT Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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