Documentation
¶
Index ¶
- func New(t testing.TB) (given SPVWalletApplicationFixture, then SPVWalletApplicationAssertions)
- func NewOf(givenSource SPVWalletApplicationFixture, t testing.TB) (given SPVWalletApplicationFixture, then SPVWalletApplicationAssertions)
- type ARCFixture
- type BalanceAssertions
- type BlockHeadersServiceFixture
- type JsonValueGetter
- type LastOperationAssertions
- type OperationsAssertions
- type SPVWalletAppUserAssertions
- type SPVWalletApplicationAssertions
- type SPVWalletApplicationFixture
- type SPVWalletHttpClientFixture
- type SPVWalletResponseAssertions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(t testing.TB) (given SPVWalletApplicationFixture, then SPVWalletApplicationAssertions)
func NewOf ¶
func NewOf(givenSource SPVWalletApplicationFixture, t testing.TB) (given SPVWalletApplicationFixture, then SPVWalletApplicationAssertions)
Types ¶
type ARCFixture ¶
type ARCFixture interface {
// WillRespondForBroadcast returns a http response for a broadcast request.
WillRespondForBroadcast(httpCode int, info *chainmodels.TXInfo)
// WillRespondForBroadcastWithSeenOnNetwork is a default ARC behavior for broadcasting (happy path).
WillRespondForBroadcastWithSeenOnNetwork(txID string)
}
type BalanceAssertions ¶
type BlockHeadersServiceFixture ¶
type BlockHeadersServiceFixture interface {
// WillRespondForMerkleRoots returns a http response for get merkleroots endpoint with
// provided httpCode and response
WillRespondForMerkleRoots(httpCode int, response string)
// WillRespondForMerkleRootsVerify returns a MerkleRootsConfirmations response for get merkleroot/verify endpoint with
// provided httpCode
WillRespondForMerkleRootsVerify(httpCode int, response *chainmodels.MerkleRootsConfirmations)
}
type JsonValueGetter ¶
type LastOperationAssertions ¶
type LastOperationAssertions interface {
WithTxID(txID string) LastOperationAssertions
WithValue(value int64) LastOperationAssertions
WithType(operationType string) LastOperationAssertions
WithCounterparty(counterparty string) LastOperationAssertions
WithNoCounterparty() LastOperationAssertions
WithTxStatus(txStatus string) LastOperationAssertions
WithBlockHeight(blockHeight int64) LastOperationAssertions
WithBlockHash(blockHash string) LastOperationAssertions
}
type OperationsAssertions ¶
type OperationsAssertions interface {
Last() LastOperationAssertions
}
type SPVWalletAppUserAssertions ¶
type SPVWalletAppUserAssertions interface {
Balance() BalanceAssertions
Operations() OperationsAssertions
}
type SPVWalletApplicationAssertions ¶
type SPVWalletApplicationAssertions interface {
Response(response *resty.Response) SPVWalletResponseAssertions
User(user fixtures.User) SPVWalletAppUserAssertions
ExternalPaymailHost() testpaymail.PaymailExternalAssertions
ARC() testengine.ARCAssertions
}
func Then ¶
func Then(t testing.TB, app SPVWalletApplicationFixture) SPVWalletApplicationAssertions
type SPVWalletApplicationFixture ¶
type SPVWalletApplicationFixture interface {
StartedSPVWallet() (cleanup func())
StartedSPVWalletWithConfiguration(opts ...testengine.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
// BHS creates a new test fixture for Block Header Service (BHS)
BHS() BlockHeadersServiceFixture
// ARC creates a new test fixture for ARC
ARC() ARCFixture
Paymail() testpaymail.PaymailClientFixture
Faucet(user fixtures.User) testengine.FaucetFixture
User(user fixtures.User) testengine.UserFixture
EngineFixture() testengine.EngineFixture
// Tx creates a new mocked transaction builder
Tx() txtestability.TransactionSpec
Config() *config.AppConfig
}
func Given ¶
func Given(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
IsCreated() SPVWalletResponseAssertions
HasStatus(status int) SPVWalletResponseAssertions
WithJSONf(expectedFormat string, args ...any)
WithJSONMatching(expectedTemplateFormat string, params map[string]any)
WithProblemDetails(status int, errType string, containDetails ...string)
JSONValue() JsonValueGetter
IsUnauthorized()
IsUnauthorizedForAdmin()
// IsUnauthorizedForUser asserts that the response status code is 401 and the error is that only admin is authorized to use this endpoint.
IsBadRequest() SPVWalletResponseAssertions
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.