integration_tests

package
v0.0.0-...-5abcb53 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: GPL-3.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const SendPaymentMockError = "mocked send payment error"

Variables

This section is empty.

Functions

func LndHubTestServiceInit

func LndHubTestServiceInit(lndClientMock lnd.LightningClientWrapper) (svc *service.LndhubService, err error)

Types

type ExpectedAddInvoiceRequestBody

type ExpectedAddInvoiceRequestBody struct {
	Amount          interface{} `json:"amt"` // amount in Satoshi
	Memo            string      `json:"memo"`
	DescriptionHash string      `json:"description_hash" validate:"omitempty,hexadecimal,len=64"`
}

type ExpectedAddInvoiceResponseBody

type ExpectedAddInvoiceResponseBody struct {
	RHash          string `json:"r_hash"`
	PaymentRequest string `json:"payment_request"`
	PayReq         string `json:"pay_req"`
}

type ExpectedAuthRequestBody

type ExpectedAuthRequestBody struct {
	Login        string `json:"login"`
	Password     string `json:"password"`
	RefreshToken string `json:"refresh_token"`
}

type ExpectedAuthResponseBody

type ExpectedAuthResponseBody struct {
	RefreshToken string `json:"refresh_token"`
	AccessToken  string `json:"access_token"`
}

type ExpectedBalanceResponse

type ExpectedBalanceResponse struct {
	BTC struct {
		AvailableBalance int64
	}
}

type ExpectedCheckPaymentResponseBody

type ExpectedCheckPaymentResponseBody struct {
	IsPaid bool `json:"paid"`
}

type ExpectedCreateUserRequestBody

type ExpectedCreateUserRequestBody struct {
	Login       string `json:"login"`
	Password    string `json:"password"`
	PartnerID   string `json:"partnerid"`
	AccountType string `json:"accounttype"`
}

type ExpectedCreateUserResponseBody

type ExpectedCreateUserResponseBody struct {
	Login    string `json:"login"`
	Password string `json:"password"`
}

type ExpectedIncomingInvoice

type ExpectedIncomingInvoice struct {
	RHash          interface{}       `json:"r_hash"`
	PaymentHash    interface{}       `json:"payment_hash"`
	PaymentRequest string            `json:"payment_request"`
	Description    string            `json:"description"`
	PayReq         string            `json:"pay_req"`
	Timestamp      int64             `json:"timestamp"`
	Type           string            `json:"type"`
	ExpireTime     int64             `json:"expire_time"`
	Amount         int64             `json:"amt"`
	IsPaid         bool              `json:"ispaid"`
	Keysend        bool              `json:"keysend"`
	CustomRecords  map[uint64][]byte `json:"custom_records"`
}

type ExpectedInvoiceEventWrapper

type ExpectedInvoiceEventWrapper struct {
	Type    string                   `json:"type"`
	Invoice *ExpectedIncomingInvoice `json:"invoice,omitempty"`
}

type ExpectedKeySendRequestBody

type ExpectedKeySendRequestBody struct {
	Amount        int64             `json:"amount" validate:"required"`
	Destination   string            `json:"destination" validate:"required"`
	Memo          string            `json:"memo" validate:"omitempty"`
	CustomRecords map[string]string `json:"customRecords" validate:"omitempty"`
}

type ExpectedKeySendResponseBody

type ExpectedKeySendResponseBody struct {
	RHash              *lib.JavaScriptBuffer `json:"payment_hash,omitempty"`
	Amount             int64                 `json:"num_satoshis,omitempty"`
	Description        string                `json:"description,omitempty"`
	Destination        string                `json:"destination,omitempty"`
	DescriptionHashStr string                `json:"description_hash,omitempty"`
	PaymentError       string                `json:"payment_error,omitempty"`
	PaymentPreimage    *lib.JavaScriptBuffer `json:"payment_preimage,omitempty"`
	PaymentRoute       *service.Route        `json:"payment_route,omitempty"`
}

type ExpectedOutgoingInvoice

type ExpectedOutgoingInvoice struct {
	RHash           interface{} `json:"r_hash"`
	PaymentHash     interface{} `json:"payment_hash"`
	PaymentPreimage string      `json:"payment_preimage"`
	Value           int64       `json:"value"`
	Type            string      `json:"type"`
	Fee             int64       `json:"fee"`
	Timestamp       int64       `json:"timestamp"`
	Memo            string      `json:"memo"`
}

type ExpectedPayInvoiceRequestBody

type ExpectedPayInvoiceRequestBody struct {
	Invoice string      `json:"invoice" validate:"required"`
	Amount  interface{} `json:"amount" validate:"omitempty"`
}

type ExpectedPayInvoiceResponseBody

type ExpectedPayInvoiceResponseBody struct {
	RHash              *lib.JavaScriptBuffer `json:"payment_hash,omitempty"`
	PaymentRequest     string                `json:"payment_request,omitempty"`
	PayReq             string                `json:"pay_req,omitempty"`
	Amount             int64                 `json:"num_satoshis,omitempty"`
	Description        string                `json:"description,omitempty"`
	DescriptionHashStr string                `json:"description_hash,omitempty"`
	PaymentError       string                `json:"payment_error,omitempty"`
	PaymentPreimage    *lib.JavaScriptBuffer `json:"payment_preimage,omitempty"`
	PaymentRoute       *service.Route        `json:"payment_route,omitempty"`
}

type ExpectedV2AddInvoiceRequestBody

type ExpectedV2AddInvoiceRequestBody struct {
	Amount          int64  `json:"amount"` // amount in Satoshi
	Memo            string `json:"description"`
	DescriptionHash string `json:"description_hash,omitempty" validate:"omitempty,hexadecimal,len=64"`
}

type HodlPaymentSubscriber

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

func (*HodlPaymentSubscriber) Recv

func (hps *HodlPaymentSubscriber) Recv() (*lnrpc.Payment, error)

wait for channel, then return

type LNDMockHodlWrapperAsync

type LNDMockHodlWrapperAsync struct {
	lnd.LightningClientWrapper
	// contains filtered or unexported fields
}

func NewLNDMockHodlWrapperAsync

func NewLNDMockHodlWrapperAsync(lnd lnd.LightningClientWrapper) (result *LNDMockHodlWrapperAsync, err error)

func (*LNDMockHodlWrapperAsync) SendPaymentSync

func (wrapper *LNDMockHodlWrapperAsync) SendPaymentSync(ctx context.Context, req *lnrpc.SendRequest, options ...grpc.CallOption) (*lnrpc.SendResponse, error)

func (*LNDMockHodlWrapperAsync) SettlePayment

func (wrapper *LNDMockHodlWrapperAsync) SettlePayment(payment lnrpc.Payment)

func (*LNDMockHodlWrapperAsync) SubscribePayment

type LNDMockWrapper

type LNDMockWrapper struct {
	lnd.LightningClientWrapper
}

func NewLNDMockHodlWrapper

func NewLNDMockHodlWrapper(lnd lnd.LightningClientWrapper) (result *LNDMockWrapper, err error)

func NewLNDMockWrapper

func NewLNDMockWrapper(lnd lnd.LightningClientWrapper) (result *LNDMockWrapper, err error)

func (*LNDMockWrapper) SendPaymentSync

func (wrapper *LNDMockWrapper) SendPaymentSync(ctx context.Context, req *lnrpc.SendRequest, options ...grpc.CallOption) (*lnrpc.SendResponse, error)

type LNDMockWrapperAsync

type LNDMockWrapperAsync struct {
	lnd.LightningClientWrapper
}

func NewLNDMockWrapperAsync

func NewLNDMockWrapperAsync(lnd lnd.LightningClientWrapper) (result *LNDMockWrapperAsync, err error)

func (*LNDMockWrapperAsync) FailPayment

func (wrapper *LNDMockWrapperAsync) FailPayment(message string)

func (*LNDMockWrapperAsync) SendPaymentSync

func (wrapper *LNDMockWrapperAsync) SendPaymentSync(ctx context.Context, req *lnrpc.SendRequest, options ...grpc.CallOption) (*lnrpc.SendResponse, error)

type MockLND

type MockLND struct {
	Sub *MockSubscribeInvoices

	GetInfoError error
	// contains filtered or unexported fields
}

func NewMockLND

func NewMockLND(privkey string, fee int64, invoiceChan chan (*lnrpc.Invoice)) (*MockLND, error)

func (*MockLND) AddInvoice

func (mlnd *MockLND) AddInvoice(ctx context.Context, req *lnrpc.Invoice, options ...grpc.CallOption) (*lnrpc.AddInvoiceResponse, error)

func (*MockLND) DecodeBolt11

func (mlnd *MockLND) DecodeBolt11(ctx context.Context, bolt11 string, options ...grpc.CallOption) (*lnrpc.PayReq, error)

func (*MockLND) GetInfo

func (mlnd *MockLND) GetInfo(ctx context.Context, req *lnrpc.GetInfoRequest, options ...grpc.CallOption) (*lnrpc.GetInfoResponse, error)

func (*MockLND) GetMainPubkey

func (mlnd *MockLND) GetMainPubkey() (pubkey string)

func (*MockLND) IsIdentityPubkey

func (mlnd *MockLND) IsIdentityPubkey(pubkey string) (isOurPubkey bool)

func (*MockLND) ListChannels

func (mlnd *MockLND) ListChannels(ctx context.Context, req *lnrpc.ListChannelsRequest, options ...grpc.CallOption) (*lnrpc.ListChannelsResponse, error)

func (*MockLND) SendPaymentSync

func (mlnd *MockLND) SendPaymentSync(ctx context.Context, req *lnrpc.SendRequest, options ...grpc.CallOption) (*lnrpc.SendResponse, error)

func (*MockLND) SubscribeInvoices

func (mlnd *MockLND) SubscribeInvoices(ctx context.Context, req *lnrpc.InvoiceSubscription, options ...grpc.CallOption) (lnd.SubscribeInvoicesWrapper, error)

func (*MockLND) SubscribePayment

func (mlnd *MockLND) SubscribePayment(ctx context.Context, req *routerrpc.TrackPaymentRequest, options ...grpc.CallOption) (lnd.SubscribePaymentWrapper, error)

func (*MockLND) TrackPayment

func (mlnd *MockLND) TrackPayment(ctx context.Context, hash []byte, options ...grpc.CallOption) (*lnrpc.Payment, error)

type MockSubscribeInvoices

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

func (*MockSubscribeInvoices) Recv

func (mockSub *MockSubscribeInvoices) Recv() (*lnrpc.Invoice, error)

type TestSuite

type TestSuite struct {
	suite.Suite
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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