Documentation
¶
Index ¶
- type HTTPClientMock
- type OpenAIClientMock
- func (mock *OpenAIClientMock) CreateChatCompletion(contextMoqParam context.Context, ...) (openai.ChatCompletionResponse, error)
- func (mock *OpenAIClientMock) CreateChatCompletionCalls() []struct{ ... }
- func (mock *OpenAIClientMock) ResetCalls()
- func (mock *OpenAIClientMock) ResetCreateChatCompletionCalls()
- type SampleUpdaterMock
- func (mock *SampleUpdaterMock) Append(msg string) error
- func (mock *SampleUpdaterMock) AppendCalls() []struct{ ... }
- func (mock *SampleUpdaterMock) Reader() (io.ReadCloser, error)
- func (mock *SampleUpdaterMock) ReaderCalls() []struct{}
- func (mock *SampleUpdaterMock) Remove(msg string) error
- func (mock *SampleUpdaterMock) RemoveCalls() []struct{ ... }
- func (mock *SampleUpdaterMock) ResetAppendCalls()
- func (mock *SampleUpdaterMock) ResetCalls()
- func (mock *SampleUpdaterMock) ResetReaderCalls()
- func (mock *SampleUpdaterMock) ResetRemoveCalls()
- type UserStorageMock
- func (mock *UserStorageMock) Delete(ctx context.Context, id string) error
- func (mock *UserStorageMock) DeleteCalls() []struct{ ... }
- func (mock *UserStorageMock) Read(ctx context.Context) ([]approved.UserInfo, error)
- func (mock *UserStorageMock) ReadCalls() []struct{ ... }
- func (mock *UserStorageMock) ResetCalls()
- func (mock *UserStorageMock) ResetDeleteCalls()
- func (mock *UserStorageMock) ResetReadCalls()
- func (mock *UserStorageMock) ResetWriteCalls()
- func (mock *UserStorageMock) Write(ctx context.Context, au approved.UserInfo) error
- func (mock *UserStorageMock) WriteCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPClientMock ¶
type HTTPClientMock struct { // DoFunc mocks the Do method. DoFunc func(req *http.Request) (*http.Response, error) // contains filtered or unexported fields }
HTTPClientMock is a mock implementation of tgspam.HTTPClient.
func TestSomethingThatUsesHTTPClient(t *testing.T) { // make and configure a mocked tgspam.HTTPClient mockedHTTPClient := &HTTPClientMock{ DoFunc: func(req *http.Request) (*http.Response, error) { panic("mock out the Do method") }, } // use mockedHTTPClient in code that requires tgspam.HTTPClient // and then make assertions. }
func (*HTTPClientMock) DoCalls ¶
func (mock *HTTPClientMock) DoCalls() []struct { Req *http.Request }
DoCalls gets all the calls that were made to Do. Check the length with:
len(mockedHTTPClient.DoCalls())
func (*HTTPClientMock) ResetCalls ¶
func (mock *HTTPClientMock) ResetCalls()
ResetCalls reset all the calls that were made to all mocked methods.
func (*HTTPClientMock) ResetDoCalls ¶
func (mock *HTTPClientMock) ResetDoCalls()
ResetDoCalls reset all the calls that were made to Do.
type OpenAIClientMock ¶
type OpenAIClientMock struct { // CreateChatCompletionFunc mocks the CreateChatCompletion method. CreateChatCompletionFunc func(contextMoqParam context.Context, chatCompletionRequest openai.ChatCompletionRequest) (openai.ChatCompletionResponse, error) // contains filtered or unexported fields }
OpenAIClientMock is a mock implementation of tgspam.openAIClient.
func TestSomethingThatUsesopenAIClient(t *testing.T) { // make and configure a mocked tgspam.openAIClient mockedopenAIClient := &OpenAIClientMock{ CreateChatCompletionFunc: func(contextMoqParam context.Context, chatCompletionRequest openai.ChatCompletionRequest) (openai.ChatCompletionResponse, error) { panic("mock out the CreateChatCompletion method") }, } // use mockedopenAIClient in code that requires tgspam.openAIClient // and then make assertions. }
func (*OpenAIClientMock) CreateChatCompletion ¶
func (mock *OpenAIClientMock) CreateChatCompletion(contextMoqParam context.Context, chatCompletionRequest openai.ChatCompletionRequest) (openai.ChatCompletionResponse, error)
CreateChatCompletion calls CreateChatCompletionFunc.
func (*OpenAIClientMock) CreateChatCompletionCalls ¶
func (mock *OpenAIClientMock) CreateChatCompletionCalls() []struct { ContextMoqParam context.Context ChatCompletionRequest openai.ChatCompletionRequest }
CreateChatCompletionCalls gets all the calls that were made to CreateChatCompletion. Check the length with:
len(mockedopenAIClient.CreateChatCompletionCalls())
func (*OpenAIClientMock) ResetCalls ¶ added in v1.16.0
func (mock *OpenAIClientMock) ResetCalls()
ResetCalls reset all the calls that were made to all mocked methods.
func (*OpenAIClientMock) ResetCreateChatCompletionCalls ¶ added in v1.16.0
func (mock *OpenAIClientMock) ResetCreateChatCompletionCalls()
ResetCreateChatCompletionCalls reset all the calls that were made to CreateChatCompletion.
type SampleUpdaterMock ¶
type SampleUpdaterMock struct { // AppendFunc mocks the Append method. AppendFunc func(msg string) error // ReaderFunc mocks the Reader method. ReaderFunc func() (io.ReadCloser, error) // RemoveFunc mocks the Remove method. RemoveFunc func(msg string) error // contains filtered or unexported fields }
SampleUpdaterMock is a mock implementation of tgspam.SampleUpdater.
func TestSomethingThatUsesSampleUpdater(t *testing.T) { // make and configure a mocked tgspam.SampleUpdater mockedSampleUpdater := &SampleUpdaterMock{ AppendFunc: func(msg string) error { panic("mock out the Append method") }, ReaderFunc: func() (io.ReadCloser, error) { panic("mock out the Reader method") }, RemoveFunc: func(msg string) error { panic("mock out the Remove method") }, } // use mockedSampleUpdater in code that requires tgspam.SampleUpdater // and then make assertions. }
func (*SampleUpdaterMock) Append ¶
func (mock *SampleUpdaterMock) Append(msg string) error
Append calls AppendFunc.
func (*SampleUpdaterMock) AppendCalls ¶
func (mock *SampleUpdaterMock) AppendCalls() []struct { Msg string }
AppendCalls gets all the calls that were made to Append. Check the length with:
len(mockedSampleUpdater.AppendCalls())
func (*SampleUpdaterMock) Reader ¶
func (mock *SampleUpdaterMock) Reader() (io.ReadCloser, error)
Reader calls ReaderFunc.
func (*SampleUpdaterMock) ReaderCalls ¶
func (mock *SampleUpdaterMock) ReaderCalls() []struct { }
ReaderCalls gets all the calls that were made to Reader. Check the length with:
len(mockedSampleUpdater.ReaderCalls())
func (*SampleUpdaterMock) Remove ¶ added in v1.16.0
func (mock *SampleUpdaterMock) Remove(msg string) error
Remove calls RemoveFunc.
func (*SampleUpdaterMock) RemoveCalls ¶ added in v1.16.0
func (mock *SampleUpdaterMock) RemoveCalls() []struct { Msg string }
RemoveCalls gets all the calls that were made to Remove. Check the length with:
len(mockedSampleUpdater.RemoveCalls())
func (*SampleUpdaterMock) ResetAppendCalls ¶
func (mock *SampleUpdaterMock) ResetAppendCalls()
ResetAppendCalls reset all the calls that were made to Append.
func (*SampleUpdaterMock) ResetCalls ¶
func (mock *SampleUpdaterMock) ResetCalls()
ResetCalls reset all the calls that were made to all mocked methods.
func (*SampleUpdaterMock) ResetReaderCalls ¶
func (mock *SampleUpdaterMock) ResetReaderCalls()
ResetReaderCalls reset all the calls that were made to Reader.
func (*SampleUpdaterMock) ResetRemoveCalls ¶ added in v1.16.0
func (mock *SampleUpdaterMock) ResetRemoveCalls()
ResetRemoveCalls reset all the calls that were made to Remove.
type UserStorageMock ¶
type UserStorageMock struct { // DeleteFunc mocks the Delete method. DeleteFunc func(ctx context.Context, id string) error // ReadFunc mocks the Read method. ReadFunc func(ctx context.Context) ([]approved.UserInfo, error) // WriteFunc mocks the Write method. WriteFunc func(ctx context.Context, au approved.UserInfo) error // contains filtered or unexported fields }
UserStorageMock is a mock implementation of tgspam.UserStorage.
func TestSomethingThatUsesUserStorage(t *testing.T) { // make and configure a mocked tgspam.UserStorage mockedUserStorage := &UserStorageMock{ DeleteFunc: func(ctx context.Context, id string) error { panic("mock out the Delete method") }, ReadFunc: func(ctx context.Context) ([]approved.UserInfo, error) { panic("mock out the Read method") }, WriteFunc: func(ctx context.Context, au approved.UserInfo) error { panic("mock out the Write method") }, } // use mockedUserStorage in code that requires tgspam.UserStorage // and then make assertions. }
func (*UserStorageMock) Delete ¶
func (mock *UserStorageMock) Delete(ctx context.Context, id string) error
Delete calls DeleteFunc.
func (*UserStorageMock) DeleteCalls ¶
func (mock *UserStorageMock) DeleteCalls() []struct { Ctx context.Context ID string }
DeleteCalls gets all the calls that were made to Delete. Check the length with:
len(mockedUserStorage.DeleteCalls())
func (*UserStorageMock) ReadCalls ¶
func (mock *UserStorageMock) ReadCalls() []struct { Ctx context.Context }
ReadCalls gets all the calls that were made to Read. Check the length with:
len(mockedUserStorage.ReadCalls())
func (*UserStorageMock) ResetCalls ¶
func (mock *UserStorageMock) ResetCalls()
ResetCalls reset all the calls that were made to all mocked methods.
func (*UserStorageMock) ResetDeleteCalls ¶
func (mock *UserStorageMock) ResetDeleteCalls()
ResetDeleteCalls reset all the calls that were made to Delete.
func (*UserStorageMock) ResetReadCalls ¶
func (mock *UserStorageMock) ResetReadCalls()
ResetReadCalls reset all the calls that were made to Read.
func (*UserStorageMock) ResetWriteCalls ¶
func (mock *UserStorageMock) ResetWriteCalls()
ResetWriteCalls reset all the calls that were made to Write.
func (*UserStorageMock) WriteCalls ¶
func (mock *UserStorageMock) WriteCalls() []struct { Ctx context.Context Au approved.UserInfo }
WriteCalls gets all the calls that were made to Write. Check the length with:
len(mockedUserStorage.WriteCalls())