mock

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 5 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

Overview

Package mock provides hand-written mock implementations of Prism's plugin interfaces for use in unit and integration tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CollectionProvider

type CollectionProvider struct {
	GetPersonFunc            func(ctx context.Context, personID int) (*tmdb.Person, error)
	GetPersonFilmographyFunc func(ctx context.Context, personID int, personType string) ([]tmdb.FilmographyItem, error)
	SearchPeopleFunc         func(ctx context.Context, query string) ([]tmdb.PersonSearchResult, error)
	SearchFranchisesFunc     func(ctx context.Context, query string) ([]tmdb.FranchiseSearchResult, error)
	GetFranchiseFunc         func(ctx context.Context, collectionID int) (*tmdb.FranchiseDetail, error)
}

CollectionProvider is a configurable mock of collection.MetadataProvider.

func (*CollectionProvider) GetFranchise

func (m *CollectionProvider) GetFranchise(ctx context.Context, collectionID int) (*tmdb.FranchiseDetail, error)

func (*CollectionProvider) GetPerson

func (m *CollectionProvider) GetPerson(ctx context.Context, personID int) (*tmdb.Person, error)

func (*CollectionProvider) GetPersonFilmography

func (m *CollectionProvider) GetPersonFilmography(ctx context.Context, personID int, personType string) ([]tmdb.FilmographyItem, error)

func (*CollectionProvider) SearchFranchises

func (m *CollectionProvider) SearchFranchises(ctx context.Context, query string) ([]tmdb.FranchiseSearchResult, error)

func (*CollectionProvider) SearchPeople

func (m *CollectionProvider) SearchPeople(ctx context.Context, query string) ([]tmdb.PersonSearchResult, error)

type DownloadClient

type DownloadClient struct {
	AddFunc           func(ctx context.Context, r plugin.Release) (string, error)
	StatusFunc        func(ctx context.Context, clientItemID string) (plugin.QueueItem, error)
	GetQueueFunc      func(ctx context.Context) ([]plugin.QueueItem, error)
	RemoveFunc        func(ctx context.Context, clientItemID string, deleteFiles bool) error
	TestFunc          func(ctx context.Context) error
	SetSeedLimitsFunc func(ctx context.Context, clientItemID string, ratioLimit float64, seedTimeSecs int) error

	Calls []string
	// contains filtered or unexported fields
}

DownloadClient is a configurable mock of plugin.DownloadClient.

func (*DownloadClient) Add

func (*DownloadClient) GetCalls

func (m *DownloadClient) GetCalls() []string

GetCalls returns a snapshot of recorded calls (thread-safe).

func (*DownloadClient) GetQueue

func (m *DownloadClient) GetQueue(ctx context.Context) ([]plugin.QueueItem, error)

func (*DownloadClient) Name

func (m *DownloadClient) Name() string

func (*DownloadClient) Protocol

func (m *DownloadClient) Protocol() plugin.Protocol

func (*DownloadClient) Remove

func (m *DownloadClient) Remove(ctx context.Context, clientItemID string, deleteFiles bool) error

func (*DownloadClient) SetSeedLimits

func (m *DownloadClient) SetSeedLimits(ctx context.Context, clientItemID string, ratioLimit float64, seedTimeSecs int) error

func (*DownloadClient) Status

func (m *DownloadClient) Status(ctx context.Context, clientItemID string) (plugin.QueueItem, error)

func (*DownloadClient) Test

func (m *DownloadClient) Test(ctx context.Context) error

type Indexer

type Indexer struct {
	CapabilitiesFunc func(ctx context.Context) (plugin.Capabilities, error)
	SearchFunc       func(ctx context.Context, q plugin.SearchQuery) ([]plugin.Release, error)
	GetRecentFunc    func(ctx context.Context) ([]plugin.Release, error)
	TestFunc         func(ctx context.Context) error

	Calls []string
}

Indexer is a configurable mock of plugin.Indexer. Set the Func fields to control return values; leave nil to return zero values. Calls records the names of methods that were invoked.

func (*Indexer) Capabilities

func (m *Indexer) Capabilities(ctx context.Context) (plugin.Capabilities, error)

func (*Indexer) GetRecent

func (m *Indexer) GetRecent(ctx context.Context) ([]plugin.Release, error)

func (*Indexer) Name

func (m *Indexer) Name() string

func (*Indexer) Protocol

func (m *Indexer) Protocol() plugin.Protocol

func (*Indexer) Search

func (m *Indexer) Search(ctx context.Context, q plugin.SearchQuery) ([]plugin.Release, error)

func (*Indexer) Test

func (m *Indexer) Test(ctx context.Context) error

type Notifier

type Notifier struct {
	NotifyFunc func(ctx context.Context, event plugin.NotificationEvent) error
	TestFunc   func(ctx context.Context) error

	Calls  []string
	Events []plugin.NotificationEvent
}

Notifier is a configurable mock of plugin.Notifier.

func (*Notifier) Name

func (m *Notifier) Name() string

func (*Notifier) Notify

func (m *Notifier) Notify(ctx context.Context, event plugin.NotificationEvent) error

func (*Notifier) Test

func (m *Notifier) Test(ctx context.Context) error

type TMDBClient

type TMDBClient struct {
	SearchMoviesFunc func(ctx context.Context, query string, year int) ([]tmdb.SearchResult, error)
	GetMovieFunc     func(ctx context.Context, tmdbID int) (*tmdb.MovieDetail, error)

	Calls []string
}

TMDBClient is a configurable mock of movie.MetadataProvider.

func (*TMDBClient) GetMovie

func (m *TMDBClient) GetMovie(ctx context.Context, tmdbID int) (*tmdb.MovieDetail, error)

func (*TMDBClient) SearchMovies

func (m *TMDBClient) SearchMovies(ctx context.Context, query string, year int) ([]tmdb.SearchResult, error)

Jump to

Keyboard shortcuts

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