testabilities

package
v1.0.0-beta.32 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

Types

type ConfigOpts

type ConfigOpts func(*config.AppConfig)

type SPVWalletApplicationAssertions

type SPVWalletApplicationAssertions interface {
	Response(response *resty.Response) SPVWalletResponseAssertions
}

type SPVWalletApplicationFixture

type SPVWalletApplicationFixture interface {
	StartedSPVWallet() (cleanup func())
	StartedSPVWalletWithConfiguration(opts ...ConfigOpts) (cleanup func())

	// HttpClient returns a new http client that can be used to make requests to the spv-wallet server.
	// It is also failing tests if there are network or invalid request configuration errors,
	// so the tests can focus on the server response.
	HttpClient() SPVWalletHttpClientFixture

	// NewTest creates a new test fixture based on the current one and the provided testing.TB
	// This is useful if you want to start spv-wallet once and then run multiple t.Run with some calls against this one instance.
	NewTest(t testing.TB) SPVWalletApplicationFixture
}

type SPVWalletHttpClientFixture

type SPVWalletHttpClientFixture interface {
	// ForAnonymous returns a new http client that is configured without any authentication.
	ForAnonymous() *resty.Client
	// ForAdmin returns a new http client that is configured with the authentication with default admin xpub.
	ForAdmin() *resty.Client
	// ForUser returns a new http client that is configured with the authentication with the xpub of the sender user.
	ForUser() *resty.Client
	// ForGivenUser returns a new http client that is configured with the authentication with the xpub of the given user.
	ForGivenUser(user fixtures.User) *resty.Client
}

type SPVWalletResponseAssertions

type SPVWalletResponseAssertions interface {
	IsOK() SPVWalletResponseAssertions
	WithJSONf(expectedFormat string, args ...any)
	// IsUnauthorized asserts that the response status code is 401 and the error is about lack of authorization.
	IsUnauthorized()
	// IsUnauthorizedForAdmin asserts that the response status code is 401 and the error is that admin is not authorized to use the endpoint.
	IsUnauthorizedForAdmin()
	IsBadRequest() SPVWalletResponseAssertions
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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