sponsorkit.mock

Mock mode.

On this page
import sponsorkit.mock

Mock mode.

The presets are embedded byte-for-byte from the conformance kit's fixtures/mock-presets.json (shipped as sponsorkit/mock_presets.json) and expanded with the rules listed in that file.

Exports#

NameKindSummary
MOCK_PRESET_NAMESconstantEvery mock preset name, in the order of the MockPreset literal.
MockDataclassCustom mock data: the SDK reports a signed-in supporter with exactly these contributions.
MockPresettype aliasA mock preset name.
mock_checkout_contribution()functionThe contribution open_checkout() simulates in mock mode.
mock_result()functionThe result mock mode returns for a canonical target set.

Functions#

mock_result()#

def mock_result(
    targets: Sequence[Target],
    mock: MockPreset | MockData,
) -> ContributionResult

The result mock mode returns for a canonical target set.

mock_checkout_contribution()#

def mock_checkout_contribution(
    targets: Sequence[Target],
    *,
    provider: str | None = None,
    amount: int | None = None,
    currency: str | None = None,
    frequency: Frequency | None = None,
) -> Contribution

The contribution open_checkout() simulates in mock mode.

Constants#

MOCK_PRESET_NAMES#

MOCK_PRESET_NAMES: tuple[str, ...] = ('signed-out', 'none', 'active-monthly', 'one-time', 'cancelled', 'org')

Every mock preset name, in the order of the MockPreset literal.