testutil

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultMockQueuerGetTrackFunc

func DefaultMockQueuerGetTrackFunc(id spotify.ID) (*spotify.FullTrack, error)

Types

type DummyCallback

type DummyCallback struct {
	CallbackExecuted chan bool
	CheckExecuted    chan bool
}

func (*DummyCallback) Callback

func (c *DummyCallback) Callback(a *util.AuthConfig, u db.UserStore, e *helix.EventSubChannelPointsCustomRewardRedemptionEvent, success bool) error

func (*DummyCallback) CheckUser

func (c *DummyCallback) CheckUser(context.Context, *spotify.Client, *helix.EventSubChannelPointsCustomRewardRedemptionEvent)

type DummyPublisher

type DummyPublisher struct {
	Messages          chan string
	ShouldFail        bool
	IsMessageExplicit bool
}

func (DummyPublisher) Publish

func (p DummyPublisher) Publish(client queue.Queuer, url string, pref *preferences.Preference) (spotify.ID, error)

type InMemoryMessageCounter

type InMemoryMessageCounter struct {
	Msgs []*metrics.Message
}

func (*InMemoryMessageCounter) AddMessage

func (c *InMemoryMessageCounter) AddMessage(m *metrics.Message)

func (*InMemoryMessageCounter) MessagesForUser added in v1.3.1

func (c *InMemoryMessageCounter) MessagesForUser(string) []*metrics.Message

func (*InMemoryMessageCounter) RunningCount

func (c *InMemoryMessageCounter) RunningCount(int) uint64

func (*InMemoryMessageCounter) TotalMessages

func (c *InMemoryMessageCounter) TotalMessages() uint64

type InMemoryPreferenceStore

type InMemoryPreferenceStore struct {
	Data map[string]*preferences.Preference
}

func (*InMemoryPreferenceStore) AddPreference

func (s *InMemoryPreferenceStore) AddPreference(p *preferences.Preference) error

func (*InMemoryPreferenceStore) DeletePreference

func (s *InMemoryPreferenceStore) DeletePreference(id string) error

func (*InMemoryPreferenceStore) GetPreference

func (s *InMemoryPreferenceStore) GetPreference(id string) (*preferences.Preference, error)

func (*InMemoryPreferenceStore) UpdatePreference

func (s *InMemoryPreferenceStore) UpdatePreference(p *preferences.Preference) error

type InMemoryUserStore

type InMemoryUserStore struct {
	Data map[string]*users.User
}

InMemoryUserStore is used for mocking and unit testing

func (*InMemoryUserStore) AddUser

func (s *InMemoryUserStore) AddUser(user *users.User) error

func (*InMemoryUserStore) DeleteUser

func (s *InMemoryUserStore) DeleteUser(id string) error

func (*InMemoryUserStore) GetUser

func (s *InMemoryUserStore) GetUser(id string) (*users.User, error)

func (*InMemoryUserStore) UpdateUser

func (s *InMemoryUserStore) UpdateUser(user *users.User) error

type MockQueuer

type MockQueuer struct {
	ShouldFail   bool
	Messages     []spotify.ID
	Explicit     bool
	GetTrackFunc func(spotify.ID) (*spotify.FullTrack, error)
}

func (*MockQueuer) GetTrack

func (m *MockQueuer) GetTrack(ctx context.Context, id spotify.ID, opts ...spotify.RequestOption) (*spotify.FullTrack, error)

func (*MockQueuer) QueueSong

func (m *MockQueuer) QueueSong(ctx context.Context, trackID spotify.ID) error

func (*MockQueuer) Search added in v1.3.1

func (m *MockQueuer) Search(ctx context.Context, query string, t spotify.SearchType, opts ...spotify.RequestOption) (*spotify.SearchResult, error)

type MockReadCloser

type MockReadCloser struct{}

func (MockReadCloser) Close

func (m MockReadCloser) Close() error

func (MockReadCloser) Read

func (m MockReadCloser) Read(p []byte) (int, error)

Jump to

Keyboard shortcuts

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