mocks

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockchainClient

type BlockchainClient struct {
	mock.Mock
}

BlockchainClient is a mock implementation of the blockchain client

func (*BlockchainClient) DeployContract

DeployContract mocks contract deployment

func (*BlockchainClient) GetBalance

func (m *BlockchainClient) GetBalance(address string, assetID string) (*blockchain.Balance, error)

GetBalance mocks retrieving a wallet balance

func (*BlockchainClient) GetBlockHeight

func (m *BlockchainClient) GetBlockHeight() (uint32, error)

GetBlockHeight mocks retrieving the current block height

func (*BlockchainClient) GetContractStorage

func (m *BlockchainClient) GetContractStorage(scriptHash string, key string) (string, error)

GetContractStorage mocks retrieving data from a contract's storage

func (*BlockchainClient) GetTransactionInfo

func (m *BlockchainClient) GetTransactionInfo(txID string) (*blockchain.TransactionInfo, error)

GetTransactionInfo mocks retrieving transaction information

func (*BlockchainClient) InvokeContractFunction

func (m *BlockchainClient) InvokeContractFunction(scriptHash string, method string, args []interface{}) (*blockchain.InvokeResult, error)

InvokeContractFunction mocks the invocation of a smart contract function

func (*BlockchainClient) Transfer

func (m *BlockchainClient) Transfer(fromAddress string, toAddress string, amount string, assetID string) (*blockchain.TransferResult, error)

Transfer mocks a token transfer

type MockBlockchainClient

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

MockBlockchainClient is a mock implementation of the blockchain.Client interface for testing

func NewMockBlockchainClient

func NewMockBlockchainClient() *MockBlockchainClient

NewMockBlockchainClient creates a new mock blockchain client

func (*MockBlockchainClient) CallContractMethod

func (m *MockBlockchainClient) CallContractMethod(contractAddress string, method string, args ...interface{}) (interface{}, error)

CallContractMethod mocks calling a contract method

func (*MockBlockchainClient) GetBalance

func (m *MockBlockchainClient) GetBalance(address string) (float64, error)

GetBalance mocks getting a wallet balance

func (*MockBlockchainClient) GetLatestBlockHeight

func (m *MockBlockchainClient) GetLatestBlockHeight() (int64, error)

GetLatestBlockHeight mocks getting the latest block height

func (*MockBlockchainClient) GetTransactionStatus

func (m *MockBlockchainClient) GetTransactionStatus(txHash string) (string, error)

GetTransactionStatus mocks getting a transaction status

func (*MockBlockchainClient) SetTxResponse

func (m *MockBlockchainClient) SetTxResponse(txHash string, err error)

SetTxResponse sets the response for a transaction hash

func (*MockBlockchainClient) SubmitTransaction

func (m *MockBlockchainClient) SubmitTransaction(method string, params []interface{}) (string, error)

SubmitTransaction mocks submitting a transaction to the blockchain

func (*MockBlockchainClient) SubscribeToContractEvents

func (m *MockBlockchainClient) SubscribeToContractEvents(contractAddress string, event string, callback func(map[string]interface{})) error

SubscribeToContractEvents mocks subscribing to contract events

func (*MockBlockchainClient) Transfer

func (m *MockBlockchainClient) Transfer(to string, amount float64) (string, error)

Transfer mocks transferring tokens

func (*MockBlockchainClient) UnsubscribeFromContractEvents

func (m *MockBlockchainClient) UnsubscribeFromContractEvents(contractAddress string, event string) error

UnsubscribeFromContractEvents mocks unsubscribing from contract events

func (*MockBlockchainClient) WasContractMethodCalled

func (m *MockBlockchainClient) WasContractMethodCalled(contractAddress string, method string) bool

WasContractMethodCalled checks if a contract method was called

type MockGasBankRepository

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

MockGasBankRepository implements a mock repository for Gas Bank tests

func NewMockGasBankRepository

func NewMockGasBankRepository() *MockGasBankRepository

NewMockGasBankRepository creates a new mock Gas Bank repository

func (*MockGasBankRepository) CreateAccount

func (r *MockGasBankRepository) CreateAccount(ctx interface{}, account *models.GasBankAccount) (*models.GasBankAccount, error)

CreateAccount creates a new gas bank account

func (*MockGasBankRepository) CreateDepositTracker

func (r *MockGasBankRepository) CreateDepositTracker(ctx interface{}, deposit *models.DepositTracker) (*models.DepositTracker, error)

CreateDepositTracker creates a new deposit tracker

func (*MockGasBankRepository) CreateTransaction

func (r *MockGasBankRepository) CreateTransaction(ctx interface{}, tx *models.GasBankTransaction) (*models.GasBankTransaction, error)

CreateTransaction creates a new gas bank transaction

func (*MockGasBankRepository) CreateWithdrawalRequest

func (r *MockGasBankRepository) CreateWithdrawalRequest(ctx interface{}, req *models.WithdrawalRequest) (*models.WithdrawalRequest, error)

CreateWithdrawalRequest creates a new withdrawal request

func (*MockGasBankRepository) GetAccount

func (r *MockGasBankRepository) GetAccount(ctx interface{}, id string) (*models.GasBankAccount, error)

GetAccount retrieves a gas bank account by ID

func (*MockGasBankRepository) GetAccountByUserID

func (r *MockGasBankRepository) GetAccountByUserID(ctx interface{}, userID string) (*models.GasBankAccount, error)

GetAccountByUserID retrieves a gas bank account by user ID

func (*MockGasBankRepository) GetAccountByWalletAddress

func (r *MockGasBankRepository) GetAccountByWalletAddress(ctx interface{}, address string) (*models.GasBankAccount, error)

GetAccountByWalletAddress retrieves a gas bank account by wallet address

func (*MockGasBankRepository) GetDepositTrackerByTxID

func (r *MockGasBankRepository) GetDepositTrackerByTxID(ctx interface{}, txID string) (*models.DepositTracker, error)

GetDepositTrackerByTxID retrieves a deposit tracker by blockchain transaction ID

func (*MockGasBankRepository) GetTransaction

func (r *MockGasBankRepository) GetTransaction(ctx interface{}, id string) (*models.GasBankTransaction, error)

GetTransaction retrieves a gas bank transaction by ID

func (*MockGasBankRepository) GetTransactionByBlockchainTxID

func (r *MockGasBankRepository) GetTransactionByBlockchainTxID(ctx interface{}, txID string) (*models.GasBankTransaction, error)

GetTransactionByBlockchainTxID retrieves a gas bank transaction by blockchain transaction ID

func (*MockGasBankRepository) GetWithdrawalRequest

func (r *MockGasBankRepository) GetWithdrawalRequest(ctx interface{}, id string) (*models.WithdrawalRequest, error)

GetWithdrawalRequest retrieves a withdrawal request by ID

func (*MockGasBankRepository) IncrementDailyWithdrawal

func (r *MockGasBankRepository) IncrementDailyWithdrawal(ctx interface{}, accountID string, amount string) error

IncrementDailyWithdrawal increments an account's daily withdrawal amount

func (*MockGasBankRepository) ListAccounts

func (r *MockGasBankRepository) ListAccounts(ctx interface{}) ([]*models.GasBankAccount, error)

ListAccounts retrieves all gas bank accounts

func (*MockGasBankRepository) ListTransactionsByAccountID

func (r *MockGasBankRepository) ListTransactionsByAccountID(ctx interface{}, accountID string, limit int, offset int) ([]*models.GasBankTransaction, error)

ListTransactionsByAccountID retrieves gas bank transactions for an account

func (*MockGasBankRepository) ListTransactionsByUserID

func (r *MockGasBankRepository) ListTransactionsByUserID(ctx interface{}, userID string, limit int, offset int) ([]*models.GasBankTransaction, error)

ListTransactionsByUserID retrieves gas bank transactions for a user

func (*MockGasBankRepository) ListUnprocessedDeposits

func (r *MockGasBankRepository) ListUnprocessedDeposits(ctx interface{}) ([]*models.DepositTracker, error)

ListUnprocessedDeposits retrieves all unprocessed deposits

func (*MockGasBankRepository) ListWithdrawalRequestsByUserID

func (r *MockGasBankRepository) ListWithdrawalRequestsByUserID(ctx interface{}, userID string, limit int, offset int) ([]*models.WithdrawalRequest, error)

ListWithdrawalRequestsByUserID retrieves withdrawal requests for a user

func (*MockGasBankRepository) ResetDailyWithdrawal

func (r *MockGasBankRepository) ResetDailyWithdrawal(ctx interface{}, accountID string) error

ResetDailyWithdrawal resets an account's daily withdrawal amount

func (*MockGasBankRepository) UpdateAccount

func (r *MockGasBankRepository) UpdateAccount(ctx interface{}, account *models.GasBankAccount) (*models.GasBankAccount, error)

UpdateAccount updates an existing gas bank account

func (*MockGasBankRepository) UpdateBalance

func (r *MockGasBankRepository) UpdateBalance(ctx interface{}, accountID string, newBalance string, newPendingBalance string, newAvailableBalance string) error

UpdateBalance updates an account's balance

func (*MockGasBankRepository) UpdateDepositTracker

func (r *MockGasBankRepository) UpdateDepositTracker(ctx interface{}, deposit *models.DepositTracker) (*models.DepositTracker, error)

UpdateDepositTracker updates an existing deposit tracker

func (*MockGasBankRepository) UpdateTransaction

func (r *MockGasBankRepository) UpdateTransaction(ctx interface{}, tx *models.GasBankTransaction) (*models.GasBankTransaction, error)

UpdateTransaction updates an existing gas bank transaction

func (*MockGasBankRepository) UpdateWithdrawalRequest

func (r *MockGasBankRepository) UpdateWithdrawalRequest(ctx interface{}, req *models.WithdrawalRequest) (*models.WithdrawalRequest, error)

UpdateWithdrawalRequest updates an existing withdrawal request

type MockOracleRepository

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

MockOracleRepository implements a mock repository for Oracle tests

func NewMockOracleRepository

func NewMockOracleRepository() *MockOracleRepository

NewMockOracleRepository creates a new mock Oracle repository

func (*MockOracleRepository) CreateDataSource

func (r *MockOracleRepository) CreateDataSource(ctx context.Context, dataSource *models.OracleDataSource) (*models.OracleDataSource, error)

CreateDataSource creates a new Oracle data source

func (*MockOracleRepository) DeleteDataSource

func (r *MockOracleRepository) DeleteDataSource(ctx context.Context, id string) error

DeleteDataSource deletes an Oracle data source

func (*MockOracleRepository) GetDataSource

func (r *MockOracleRepository) GetDataSource(ctx context.Context, id string) (*models.OracleDataSource, error)

GetDataSource retrieves an Oracle data source by ID

func (*MockOracleRepository) ListDataSources

func (r *MockOracleRepository) ListDataSources(ctx context.Context) ([]*models.OracleDataSource, error)

ListDataSources retrieves all Oracle data sources

func (*MockOracleRepository) RecordUpdate

func (r *MockOracleRepository) RecordUpdate(ctx context.Context, id string, data string, txID string) error

RecordUpdate records a data update for a data source

func (*MockOracleRepository) UpdateDataSource

func (r *MockOracleRepository) UpdateDataSource(ctx context.Context, dataSource *models.OracleDataSource) (*models.OracleDataSource, error)

UpdateDataSource updates an existing Oracle data source

func (*MockOracleRepository) UpdateLastUpdated

func (r *MockOracleRepository) UpdateLastUpdated(ctx context.Context, id string) error

UpdateLastUpdated updates the last updated timestamp for a data source

type MockPriceFeedRepository

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

MockPriceFeedRepository implements a mock repository for Price Feed tests

func NewMockPriceFeedRepository

func NewMockPriceFeedRepository() *MockPriceFeedRepository

NewMockPriceFeedRepository creates a new mock Price Feed repository

func (*MockPriceFeedRepository) AddPriceSource

func (r *MockPriceFeedRepository) AddPriceSource(ctx interface{}, priceFeedID string, source *models.PriceSource) (*models.PriceSource, error)

AddPriceSource adds a price source to a price feed

func (*MockPriceFeedRepository) CreatePriceFeed

func (r *MockPriceFeedRepository) CreatePriceFeed(ctx interface{}, priceFeed *models.PriceFeed) (*models.PriceFeed, error)

CreatePriceFeed creates a new price feed

func (*MockPriceFeedRepository) DeletePriceFeed

func (r *MockPriceFeedRepository) DeletePriceFeed(ctx interface{}, id string) error

DeletePriceFeed deletes a price feed

func (*MockPriceFeedRepository) GetPriceFeed

func (r *MockPriceFeedRepository) GetPriceFeed(ctx interface{}, id string) (*models.PriceFeed, error)

GetPriceFeed retrieves a price feed by ID

func (*MockPriceFeedRepository) GetPriceFeedBySymbol

func (r *MockPriceFeedRepository) GetPriceFeedBySymbol(ctx interface{}, symbol string) (*models.PriceFeed, error)

GetPriceFeedBySymbol retrieves a price feed by symbol

func (*MockPriceFeedRepository) GetPriceHistory

func (r *MockPriceFeedRepository) GetPriceHistory(ctx interface{}, id string, limit int) ([]*models.PriceUpdate, error)

GetPriceHistory retrieves the price history for a price feed

func (*MockPriceFeedRepository) ListPriceFeeds

func (r *MockPriceFeedRepository) ListPriceFeeds(ctx interface{}) ([]*models.PriceFeed, error)

ListPriceFeeds retrieves all price feeds

func (*MockPriceFeedRepository) RecordPriceUpdate

func (r *MockPriceFeedRepository) RecordPriceUpdate(ctx interface{}, id string, price float64, txID string) error

RecordPriceUpdate records a price update

func (*MockPriceFeedRepository) RemovePriceSource

func (r *MockPriceFeedRepository) RemovePriceSource(ctx interface{}, priceFeedID string, sourceID string) error

RemovePriceSource removes a price source from a price feed

func (*MockPriceFeedRepository) UpdateLastPrice

func (r *MockPriceFeedRepository) UpdateLastPrice(ctx interface{}, id string, price float64, txHash string) error

UpdateLastPrice updates the last price for a price feed

func (*MockPriceFeedRepository) UpdatePriceFeed

func (r *MockPriceFeedRepository) UpdatePriceFeed(ctx interface{}, priceFeed *models.PriceFeed) (*models.PriceFeed, error)

UpdatePriceFeed updates an existing price feed

type MockTEEManager

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

MockTEEManager is a mock implementation of the tee.Manager interface for testing

func NewMockTEEManager

func NewMockTEEManager() *MockTEEManager

NewMockTEEManager creates a new mock TEE manager

func (*MockTEEManager) DeleteSecret

func (m *MockTEEManager) DeleteSecret(userID int, secretName string) error

DeleteSecret mocks deleting a secret from the TEE

func (*MockTEEManager) ExecuteFunction

func (m *MockTEEManager) ExecuteFunction(functionCode string, params map[string]interface{}) ([]byte, error)

ExecuteFunction mocks executing a function in the TEE

func (*MockTEEManager) GetOracleCallCount

func (m *MockTEEManager) GetOracleCallCount(dataSourceName string) int

GetOracleCallCount returns the number of times an oracle data source was called

func (*MockTEEManager) GetSecret

func (m *MockTEEManager) GetSecret(userID int, secretName string) (string, error)

GetSecret mocks retrieving a secret from the TEE

func (*MockTEEManager) GetSecretOperations

func (m *MockTEEManager) GetSecretOperations(userID int, secretName string) []string

GetSecretOperations returns a list of operations performed on a secret

func (*MockTEEManager) SetExecutionResult

func (m *MockTEEManager) SetExecutionResult(functionName string, result interface{})

SetExecutionResult sets a predefined result for a function execution

func (*MockTEEManager) SetOracleResponse

func (m *MockTEEManager) SetOracleResponse(dataSourceName string, response interface{})

SetOracleResponse sets a mock response for an oracle data source

func (*MockTEEManager) StoreSecret

func (m *MockTEEManager) StoreSecret(userID int, secretName string, secretValue string) error

StoreSecret mocks storing a secret in the TEE

func (*MockTEEManager) WasOracleCalled

func (m *MockTEEManager) WasOracleCalled(dataSourceName string) bool

WasOracleCalled checks if an oracle data source was called

Jump to

Keyboard shortcuts

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