mock

package
v0.1.118 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: GPL-2.0, GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package mock provides a configurable mock subtitle provider for functional testing. It registers as a normal provider ("mock") and its behavior is controlled entirely through config settings:

  • mode: "static" (default), "error", "timeout", "rate_limit", "auth_error", "empty", "slow", "flaky", "season_pack"
  • delay_ms: artificial latency per Search/Download call (default 0)
  • result_count: number of results to return in static mode (default 3)
  • languages: comma-separated language codes to return results for (default: all requested)
  • error_message: custom error message for error modes
  • flaky_rate: failure probability 0.0-1.0 for flaky mode (default 0.5)
  • score_base: base score for returned subtitles (default 50)
  • include_hash: return hash-matched results (default false)
  • hearing_impaired: return HI-flagged results (default false)
  • forced: return forced-flagged results (default false)
  • download_error: if set, Download returns this error instead of data
  • subtitle_content: custom SRT content for downloads (default: generated)

The mock provider is only registered when the "mock" provider is enabled in config. It never makes network calls.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Factory

func Factory(_ context.Context, settings map[string]any) (api.Provider, error)

Factory creates a mock provider from config settings.

func Schema

func Schema() []api.ProviderSchemaField

Schema returns the UI schema fields for the mock provider settings page.

Types

This section is empty.

Jump to

Keyboard shortcuts

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