apitests

package
v0.0.0-...-f6b5033 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const EncryptedWalletPassword = "correct horse"

EncryptedWalletPassword opens the fixture wallet of WithPasswordWallet.

Variables

This section is empty.

Functions

func API

func API(t *testing.T, database *sql.DB, options ...ServerOpt) (connect.HTTPClient, string)

func CoreWalletOrchestrator

func CoreWalletOrchestrator(t *testing.T) orchrpc.WalletManagerServiceClient

CoreWalletOrchestrator returns an orchestrator client that names the Bitcoin Core wallet of a wallet as the orchestrator does. Every other call answers as unimplemented.

func ExpectCoreWalletSetup

func ExpectCoreWalletSetup(mock *mocks.MockBitcoinServiceClient)

ExpectCoreWalletSetup allows the calls the wallet engine makes in the background when it brings a Bitcoin Core wallet up. It asserts nothing: every argument matches, and zero calls pass. Its only job is to stop an unrelated background call from failing a test that cares about something else. A test that cares about one of these calls must set its own expectation, which gomock matches ahead of these.

func ExpectOrchestratorReads

func ExpectOrchestratorReads(mock *mocks.MockWalletManagerServiceClient)

ExpectOrchestratorReads allows the read-only wallet-manager calls the engines make in the background. Like ExpectCoreWalletSetup it asserts nothing.

Note the node mode it reports is FULL, so a test that exercises light mode must set its own GetNodeMode expectation.

func ExpectOrchestratorReadsWithoutFrozenCoins

func ExpectOrchestratorReadsWithoutFrozenCoins(mock *mocks.MockWalletManagerServiceClient)

ExpectOrchestratorReadsWithoutFrozenCoins is ExpectOrchestratorReads for a test that answers SetFrozenCoins itself.

Types

type ServerOpt

type ServerOpt func(opt *configg)

func WithCoreWallet

func WithCoreWallet() ServerOpt

WithCoreWallet makes the fixture wallet a Bitcoin Core one, for a test whose feature electrum cannot serve — deniability, for instance.

func WithEncryptedWallet

func WithEncryptedWallet() ServerOpt

WithEncryptedWallet marks the fixture wallet as encrypted, so the server starts with it locked.

func WithLocalAuth

func WithLocalAuth(dir string) ServerOpt

WithLocalAuth makes every route require the local-auth cookie in dir.

func WithNetwork

func WithNetwork(network config.Network) ServerOpt

WithNetwork runs the fixture on another network than regtest, for a test of behaviour the network itself decides.

func WithOrchestrator

func WithOrchestrator(client orchrpc.WalletManagerServiceClient) ServerOpt

WithOrchestrator injects the wallet-manager client cheque reads go through.

func WithPasswordWallet

func WithPasswordWallet() ServerOpt

WithPasswordWallet encrypts the electrum fixture wallet with EncryptedWalletPassword, so the server starts with it locked.

func WithWatchOnlyWallet

func WithWatchOnlyWallet() ServerOpt

WithWatchOnlyWallet makes the fixture wallet a watch-only one with no seed.

Jump to

Keyboard shortcuts

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