mocks

package
v1.0.1-0...-ec039c9 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DurationServiceMock

type DurationServiceMock struct {
	// FileFunc mocks the File method.
	FileFunc func(fname string) int
	// contains filtered or unexported fields
}

DurationServiceMock is a mock implementation of proc.DurationService.

func TestSomethingThatUsesDurationService(t *testing.T) {

	// make and configure a mocked proc.DurationService
	mockedDurationService := &DurationServiceMock{
		FileFunc: func(fname string) int {
			panic("mock out the File method")
		},
	}

	// use mockedDurationService in code that requires proc.DurationService
	// and then make assertions.

}

func (*DurationServiceMock) File

func (mock *DurationServiceMock) File(fname string) int

File calls FileFunc.

func (*DurationServiceMock) FileCalls

func (mock *DurationServiceMock) FileCalls() []struct {
	Fname string
}

FileCalls gets all the calls that were made to File. Check the length with:

len(mockedDurationService.FileCalls())

type TelegramNotifMock

type TelegramNotifMock struct {
	// SendFunc mocks the Send method.
	SendFunc func(chanID string, item feed.Item) error
	// contains filtered or unexported fields
}

TelegramNotifMock is a mock implementation of proc.TelegramNotif.

func TestSomethingThatUsesTelegramNotif(t *testing.T) {

	// make and configure a mocked proc.TelegramNotif
	mockedTelegramNotif := &TelegramNotifMock{
		SendFunc: func(chanID string, item feed.Item) error {
			panic("mock out the Send method")
		},
	}

	// use mockedTelegramNotif in code that requires proc.TelegramNotif
	// and then make assertions.

}

func (*TelegramNotifMock) Send

func (mock *TelegramNotifMock) Send(chanID string, item feed.Item) error

Send calls SendFunc.

func (*TelegramNotifMock) SendCalls

func (mock *TelegramNotifMock) SendCalls() []struct {
	ChanID string
	Item   feed.Item
}

SendCalls gets all the calls that were made to Send. Check the length with:

len(mockedTelegramNotif.SendCalls())

type TelegramSenderMock

type TelegramSenderMock struct {
	// SendFunc mocks the Send method.
	SendFunc func(audio tb.Audio, bot *tb.Bot, recipient tb.Recipient, sendOptions *tb.SendOptions) (*tb.Message, error)
	// contains filtered or unexported fields
}

TelegramSenderMock is a mock implementation of proc.TelegramSender.

func TestSomethingThatUsesTelegramSender(t *testing.T) {

	// make and configure a mocked proc.TelegramSender
	mockedTelegramSender := &TelegramSenderMock{
		SendFunc: func(audio tb.Audio, bot *tb.Bot, recipient tb.Recipient, sendOptions *tb.SendOptions) (*tb.Message, error) {
			panic("mock out the Send method")
		},
	}

	// use mockedTelegramSender in code that requires proc.TelegramSender
	// and then make assertions.

}

func (*TelegramSenderMock) Send

func (mock *TelegramSenderMock) Send(audio tb.Audio, bot *tb.Bot, recipient tb.Recipient, sendOptions *tb.SendOptions) (*tb.Message, error)

Send calls SendFunc.

func (*TelegramSenderMock) SendCalls

func (mock *TelegramSenderMock) SendCalls() []struct {
	Audio       tb.Audio
	Bot         *tb.Bot
	Recipient   tb.Recipient
	SendOptions *tb.SendOptions
}

SendCalls gets all the calls that were made to Send. Check the length with:

len(mockedTelegramSender.SendCalls())

type TweetPosterMock

type TweetPosterMock struct {
	// PostTweetFunc mocks the PostTweet method.
	PostTweetFunc func(msg string, v url.Values) (anaconda.Tweet, error)
	// contains filtered or unexported fields
}

TweetPosterMock is a mock implementation of proc.TweetPoster.

func TestSomethingThatUsesTweetPoster(t *testing.T) {

	// make and configure a mocked proc.TweetPoster
	mockedTweetPoster := &TweetPosterMock{
		PostTweetFunc: func(msg string, v url.Values) (anaconda.Tweet, error) {
			panic("mock out the PostTweet method")
		},
	}

	// use mockedTweetPoster in code that requires proc.TweetPoster
	// and then make assertions.

}

func (*TweetPosterMock) PostTweet

func (mock *TweetPosterMock) PostTweet(msg string, v url.Values) (anaconda.Tweet, error)

PostTweet calls PostTweetFunc.

func (*TweetPosterMock) PostTweetCalls

func (mock *TweetPosterMock) PostTweetCalls() []struct {
	Msg string
	V   url.Values
}

PostTweetCalls gets all the calls that were made to PostTweet. Check the length with:

len(mockedTweetPoster.PostTweetCalls())

type TwitterNotifMock

type TwitterNotifMock struct {
	// SendFunc mocks the Send method.
	SendFunc func(item feed.Item) error
	// contains filtered or unexported fields
}

TwitterNotifMock is a mock implementation of proc.TwitterNotif.

func TestSomethingThatUsesTwitterNotif(t *testing.T) {

	// make and configure a mocked proc.TwitterNotif
	mockedTwitterNotif := &TwitterNotifMock{
		SendFunc: func(item feed.Item) error {
			panic("mock out the Send method")
		},
	}

	// use mockedTwitterNotif in code that requires proc.TwitterNotif
	// and then make assertions.

}

func (*TwitterNotifMock) Send

func (mock *TwitterNotifMock) Send(item feed.Item) error

Send calls SendFunc.

func (*TwitterNotifMock) SendCalls

func (mock *TwitterNotifMock) SendCalls() []struct {
	Item feed.Item
}

SendCalls gets all the calls that were made to Send. Check the length with:

len(mockedTwitterNotif.SendCalls())

Jump to

Keyboard shortcuts

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