integration

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

README

Integration Tests

This package contains integration tests for the Open Payments client against a running instance of Rafiki. The tests can be run against the Rafiki local environment or testnet.

Testnet Environment Configuration

Environment variables for the sending testnet wallet address must be set in a .env.testnet file before running the tests. See .env.testnet.example. This is required for initializing the authenticated client and completing the interaction step for the outgoing payment grant.

[!NOTE] The sending wallet address needs to be manually funded on testnet, otherwise the incoming payment will never complete.

Running the Tests

To run all integration tests against testnet:

go test ./test/integration -v -env=testnet

Or a local rafiki environemnt:

go test ./test/integration -v -env=local

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeLocalConsent

func MakeLocalConsent() func(ctx context.Context, url string) error

func MakeLocalHostHeaderRoundTripper

func MakeLocalHostHeaderRoundTripper(portsToHost map[string]string) http.RoundTripper

func MakeLocalPostSignHook

func MakeLocalPostSignHook(hostsToPort map[string]string) func(req *http.Request)

func MakeLocalPreSignHook

func MakeLocalPreSignHook(portsToHost map[string]string) func(req *http.Request)

func MakeLocalURLRewriter

func MakeLocalURLRewriter(hostsToPort map[string]string) func(string) (string, error)

ResolveLocalURL takes a URL and replaces known backend hostnames with localhost and their corresponding ports. for example:

"http://happy-life-bank-backend/incoming-payments/f6eabfa0-3a94-4ae6-a635-bf43f9af3aee"

goes to

"http://localhost:4000/incoming-payments/f6eabfa0-3a94-4ae6-a635-bf43f9af3aee"

func MakeTestnetConsent

func MakeTestnetConsent() func(ctx context.Context, url string) error

Types

type Environment

type Environment struct {
	Name                             string
	ClientWalletAddressURL           string
	PrivateKey                       string
	KeyId                            string
	HttpClient                       *http.Client
	ReceiverWalletAddressUrl         string
	ResolvedReceiverWalletAddressUrl string
	ReceiverOpenPaymentsAuthUrl      string
	ReceiverOpenPaymentsResourceUrl  string
	ReceiverAssetScale               int
	ReceiverAssetCode                string
	SenderOpenPaymentsAuthUrl        string
	SenderWalletAddressUrl           string
	ResolvedSenderWalletAddressUrl   string
	SenderOpenPaymentsResourceUrl    string
	PreSignHook                      func(req *http.Request)
	PostSignHook                     func(req *http.Request)
	RewriteURL                       func(string) (string, error) // optional, used only in local
	Consent                          func(ctx context.Context, url string) error
}

func NewLocalEnvironment

func NewLocalEnvironment() *Environment

func NewTestnetEnvironment

func NewTestnetEnvironment() *Environment

func (*Environment) RewriteURLIfNeeded

func (env *Environment) RewriteURLIfNeeded(raw string) (string, error)

type LocalHostHeaderRoundTripper

type LocalHostHeaderRoundTripper struct {
	// contains filtered or unexported fields
}

HostHeaderRoundTripper modifies Host header to match remote services while using localhost. RoundTripper will modify all requests after DoSigned/DoUnsigned

func (*LocalHostHeaderRoundTripper) RoundTrip

func (h *LocalHostHeaderRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

type Snapshotter

type Snapshotter struct {
	Page           *rod.Page
	LastScreenshot []byte
	LastHTML       string
}

func NewSnapshotter

func NewSnapshotter(page *rod.Page) *Snapshotter

func (*Snapshotter) FlushOnError

func (s *Snapshotter) FlushOnError()

func (*Snapshotter) Snapshot

func (s *Snapshotter) Snapshot()

Jump to

Keyboard shortcuts

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