test

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckChat

func CheckChat(t *testing.T, response *types.ChatCompletionResponse, modelName string, usage *types.Usage)

func ErrorIs

func ErrorIs(t *testing.T, err, target error, msg ...string)

func ErrorIsF

func ErrorIsF(t *testing.T, err, target error, format string, msg ...string)

func ErrorIsNot

func ErrorIsNot(t *testing.T, err, target error, msg ...string)

func ErrorIsNotf

func ErrorIsNotf(t *testing.T, err, target error, format string, msg ...string)

func GetChannel

func GetChannel(channelType int, baseUrl, other, porxy, modelMapping string) model.Channel

func GetChatCompletionRequest

func GetChatCompletionRequest(chatType, modelName, stream string) *types.ChatCompletionRequest

func GetChatRequest

func GetChatRequest(chatType, modelName, stream string) *strings.Reader

func GetContext

func GetContext(method, path string, headers map[string]string, body io.Reader) (*gin.Context, *httptest.ResponseRecorder)

func GetGinRouter

func GetGinRouter(method, path string, headers map[string]string, body *io.Reader) *httptest.ResponseRecorder

func GetTestToken

func GetTestToken() string

func HasError

func HasError(t *testing.T, err error, message ...string)

func NoError

func NoError(t *testing.T, err error, message ...string)

func OpenAICheck

func OpenAICheck(w http.ResponseWriter, r *http.Request) bool

func RequestJSONConfig

func RequestJSONConfig() map[string]string

Types

type ServerTest

type ServerTest struct {
	// contains filtered or unexported fields
}

func NewTestServer

func NewTestServer() *ServerTest

func (*ServerTest) RegisterHandler

func (ts *ServerTest) RegisterHandler(path string, handler handler)

func (*ServerTest) TestServer

func (ts *ServerTest) TestServer(headerCheck func(w http.ResponseWriter, r *http.Request) bool) *httptest.Server

OpenAITestServer Creates a mocked OpenAI server which can pretend to handle requests during testing.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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