testutil

package
v0.14.1 Latest Latest
Warning

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

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTestDB

func NewTestDB(t *testing.T) *dbgen.Queries

NewTestDB creates a fresh SQLite database with all migrations applied. The database is registered with t.Cleanup to be closed after the test completes. Each call gets its own file under t.TempDir() so tests never share state.

func NewTestDBWithSQL

func NewTestDBWithSQL(t *testing.T) (*dbgen.Queries, *sql.DB)

NewTestDBWithSQL returns both the Queries and the underlying *sql.DB. Use this when you need to execute raw SQL in tests (e.g. for low-level assertions).

func SeedGrabHistory

func SeedGrabHistory(t *testing.T, q *dbgen.Queries, movieID, title string) dbgen.GrabHistory

SeedGrabHistory inserts one grab_history row for movieID and returns it.

func SeedLibrary

func SeedLibrary(t *testing.T, q *dbgen.Queries) dbgen.Library

SeedLibrary inserts a library backed by a freshly created quality profile.

func SeedLibraryWithProfile

func SeedLibraryWithProfile(t *testing.T, q *dbgen.Queries, profileID string) dbgen.Library

SeedLibraryWithProfile inserts a library using the given quality profile ID.

func SeedMovie

func SeedMovie(t *testing.T, q *dbgen.Queries, opts ...MovieOption) dbgen.Movie

SeedMovie inserts a movie into a freshly created library with sensible defaults.

func SeedMovieInLibrary

func SeedMovieInLibrary(t *testing.T, q *dbgen.Queries, libraryID, profileID string, opts ...MovieOption) dbgen.Movie

SeedMovieInLibrary inserts a movie into the specified library.

func SeedQualityProfile

func SeedQualityProfile(t *testing.T, q *dbgen.Queries) dbgen.QualityProfile

SeedQualityProfile inserts a quality profile with sensible defaults and returns it. The inserted profile accepts 1080p BluRay releases.

Types

type MovieOption

type MovieOption func(*dbgen.CreateMovieParams)

MovieOption is a functional option for SeedMovie.

func WithMonitored

func WithMonitored(monitored bool) MovieOption

WithMonitored sets the monitored flag on the seeded movie.

func WithTMDBID

func WithTMDBID(id int) MovieOption

WithTMDBID sets the TMDB ID on the seeded movie.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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