sponsorkit.mock
Mock mode.
import sponsorkit.mockMock 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#
| Name | Kind | Summary |
|---|---|---|
MOCK_PRESET_NAMES | constant | Every mock preset name, in the order of the MockPreset literal. |
MockData | class | Custom mock data: the SDK reports a signed-in supporter with exactly these contributions. |
MockPreset | type alias | A mock preset name. |
mock_checkout_contribution() | function | The contribution open_checkout() simulates in mock mode. |
mock_result() | function | The result mock mode returns for a canonical target set. |
Functions#
mock_result()#
def mock_result(
targets: Sequence[Target],
mock: MockPreset | MockData,
) -> ContributionResultThe 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,
) -> ContributionThe 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.