Documentation
¶
Index ¶
- Constants
- type CapabilityMock
- type MockedP2PDestination
- type MockedP2PDestinationOutput
- type MockedP2PDestinationResponse
- type MockedRecordBEEFResponse
- type PaymailClientMock
- func (c *PaymailClientMock) GetCallByRegex(r string) *tester.CallDetails
- func (c *PaymailClientMock) GetMockedBEEFTransactionURL(domain string) string
- func (c *PaymailClientMock) GetMockedP2PPaymentDestinationURL(domain string) string
- func (c *PaymailClientMock) GetMockedP2PTransactionURL(domain string) string
- func (c *PaymailClientMock) GetMockedServerURL(domain string) string
- func (c *PaymailClientMock) RedirectTransportIfDomain(domain string, transport http.RoundTripper)
- func (c *PaymailClientMock) WillRespondOnCapability(capabilityName string) *CapabilityMock
- func (c *PaymailClientMock) WillRespondWithBasicCapabilities()
- func (c *PaymailClientMock) WillRespondWithErrorOnCapabilities()
- func (c *PaymailClientMock) WillRespondWithNotFoundOnCapabilities()
- func (c *PaymailClientMock) WillRespondWithP2PCapabilities()
- func (c *PaymailClientMock) WillRespondWithP2PWithBEEFCapabilities()
- type ResponderFactory
Constants ¶
const MockedReferenceID = "z0bac4ec-6f15-42de-9ef4-e60bfdabf4f7"
MockedReferenceID is returned always by the mocked P2P destinations response
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CapabilityMock ¶
type CapabilityMock struct {
// contains filtered or unexported fields
}
CapabilityMock is a structure that helps with mocking for a paymail capability.
func (*CapabilityMock) With ¶
func (c *CapabilityMock) With(resp ResponderFactory)
With will make the capability return the response provided by responder created with the factory.
func (*CapabilityMock) WithInternalServerError ¶
func (c *CapabilityMock) WithInternalServerError()
WithInternalServerError will make the capability return the response 500 internal server error.
func (*CapabilityMock) WithNotFound ¶
func (c *CapabilityMock) WithNotFound()
WithNotFound will make the capability return the response 404 not found.
type MockedP2PDestination ¶
MockedP2PDestination is a mocked response for the P2P destinations endpoint
func P2PDestinationResponse ¶
func P2PDestinationResponse() *MockedP2PDestination
P2PDestinationResponse returns a new mocked response for the P2P destinations endpoint
func P2PDestinationsForSats ¶
func P2PDestinationsForSats(satoshis bsv.Satoshis, moreSatoshis ...bsv.Satoshis) *MockedP2PDestination
P2PDestinationsForSats returns a mocked response for the P2P destinations endpoint
func (*MockedP2PDestination) Responder ¶
func (m *MockedP2PDestination) Responder() httpmock.Responder
Responder returns a httpmock responder for the mocked P2P destinations response
type MockedP2PDestinationOutput ¶
type MockedP2PDestinationOutput struct {
Script string `json:"script"`
Satoshis bsv.Satoshis `json:"satoshis"`
}
MockedP2PDestinationOutput is a part of the mocked P2P destinations response
type MockedP2PDestinationResponse ¶
type MockedP2PDestinationResponse struct {
Reference string `json:"reference"`
Outputs []MockedP2PDestinationOutput `json:"outputs"`
}
MockedP2PDestinationResponse is a model for the mocked P2P destinations response
type MockedRecordBEEFResponse ¶
type MockedRecordBEEFResponse struct{}
MockedRecordBEEFResponse is a mocked response for the record tx endpoint
func RecordBEEFResponse ¶
func RecordBEEFResponse() *MockedRecordBEEFResponse
RecordBEEFResponse returns a new mocked response for the record tx endpoint
func (*MockedRecordBEEFResponse) Responder ¶
func (m *MockedRecordBEEFResponse) Responder() httpmock.Responder
Responder returns a httpmock responder for the mocked P2P destinations response
type PaymailClientMock ¶
type PaymailClientMock struct {
paymail.ClientInterface
// contains filtered or unexported fields
}
PaymailClientMock is a paymail.Client configured to use mocked endpoints.
func MockClient ¶
func MockClient(mockTransport *httpmock.MockTransport, domain string, moreDomainNames ...string) *PaymailClientMock
MockClient will return a client for testing purposes
func (*PaymailClientMock) GetCallByRegex ¶
func (c *PaymailClientMock) GetCallByRegex(r string) *tester.CallDetails
GetCallByRegex is returning the details of a call made to the mocked server by a URL matching a regex.
func (*PaymailClientMock) GetMockedBEEFTransactionURL ¶
func (c *PaymailClientMock) GetMockedBEEFTransactionURL(domain string) string
GetMockedBEEFTransactionURL is returning the mocked BEEF Transaction URL for a given domain if it is mocked.
func (*PaymailClientMock) GetMockedP2PPaymentDestinationURL ¶
func (c *PaymailClientMock) GetMockedP2PPaymentDestinationURL(domain string) string
GetMockedP2PPaymentDestinationURL is returning the mocked P2P Payment Destination URL for a given domain if it is mocked.
func (*PaymailClientMock) GetMockedP2PTransactionURL ¶
func (c *PaymailClientMock) GetMockedP2PTransactionURL(domain string) string
GetMockedP2PTransactionURL is returning the mocked P2P Transaction URL for a given domain if it is mocked.
func (*PaymailClientMock) GetMockedServerURL ¶
func (c *PaymailClientMock) GetMockedServerURL(domain string) string
GetMockedServerURL is returning the mocked URL for a given domain if it is mocked.
func (*PaymailClientMock) RedirectTransportIfDomain ¶
func (c *PaymailClientMock) RedirectTransportIfDomain(domain string, transport http.RoundTripper)
RedirectTransportIfDomain is configuring a client to redirect all requests to a given domain to a custom transport.
func (*PaymailClientMock) WillRespondOnCapability ¶
func (c *PaymailClientMock) WillRespondOnCapability(capabilityName string) *CapabilityMock
WillRespondOnCapability is returning a capability mock for a given capability name.
func (*PaymailClientMock) WillRespondWithBasicCapabilities ¶
func (c *PaymailClientMock) WillRespondWithBasicCapabilities()
WillRespondWithBasicCapabilities is configuring a client to respond with basic capabilities for all mocked domains.
func (*PaymailClientMock) WillRespondWithErrorOnCapabilities ¶
func (c *PaymailClientMock) WillRespondWithErrorOnCapabilities()
WillRespondWithErrorOnCapabilities is configuring a client to respond with an error on capabilities for all mocked domains.
func (*PaymailClientMock) WillRespondWithNotFoundOnCapabilities ¶
func (c *PaymailClientMock) WillRespondWithNotFoundOnCapabilities()
WillRespondWithNotFoundOnCapabilities is configuring a client to respond with not found on capabilities for all mocked domains.
func (*PaymailClientMock) WillRespondWithP2PCapabilities ¶
func (c *PaymailClientMock) WillRespondWithP2PCapabilities()
WillRespondWithP2PCapabilities is configuring a client to respond with basic and P2P capabilities for all mocked domains.
func (*PaymailClientMock) WillRespondWithP2PWithBEEFCapabilities ¶
func (c *PaymailClientMock) WillRespondWithP2PWithBEEFCapabilities()
WillRespondWithP2PWithBEEFCapabilities is configuring a client to respond with basic, P2P and BEEF capabilities for all mocked domains.
type ResponderFactory ¶
ResponderFactory is an interface that helps with mocking for a paymail capability by creating a httpmock responder.