test

package
v0.0.0-...-629276b Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2016 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DbForTest *sql.DB

Functions

func CallMockJsonRpc

func CallMockJsonRpc(
	method string, params interface{}, reply interface{},
) error

Calls the JSONRPC service provided by StartMockJsonRpcServer

func DefaultListenAndExecute

func DefaultListenAndExecute(
	rcvr interface{}, rpcCallback func(*RpcTestEnv),
)

func ExecuteInTx

func ExecuteInTx(txCallback func(*sql.Tx))

IoC execution(in transaction)

func ExecuteOrFail

func ExecuteOrFail(query string, args ...interface{}) sql.Result

IoC execution

func ExecuteQueriesOrFailInTx

func ExecuteQueriesOrFailInTx(queries ...string)

IoC execution(in transaction)

func GetUrlOfMockedServer

func GetUrlOfMockedServer() string

Gets URL of mocked server

func HasDefaultOrmOnPortal

func HasDefaultOrmOnPortal(c *C) bool

Checks whether or not skipping testing by viable arguments

func HasTestDbConfig

func HasTestDbConfig() bool

Checks if the config of database is set

func InitDb

func InitDb()

func InitOrm

func InitOrm()

func QueryForRow

func QueryForRow(
	rowCallback func(row *sql.Row),
	sqlQuery string, args ...interface{},
)

IoC Callback for row This method would use sql.DB.QueryRow method to retrive data

func QueryForRows

func QueryForRows(
	rowsCallback func(row *sql.Rows),
	sqlQuery string, args ...interface{},
)

IoC Callback for rows This method would use sql.DB.Query method to retrive data

func ReleaseDb

func ReleaseDb()

func StartMockJsonRpcServer

func StartMockJsonRpcServer(c *C, jsonrpcServiceSetupFunc func(*rpc.Server))

Initialize mock JSONRPC server for NQM log You may use "test.mockrpc.port" to customize port of HTTP for it

func StopMockJsonRpcServer

func StopMockJsonRpcServer(c *C)

Stops the HTTP server for mocked JSONRPC services

Types

type RpcTestEnv

type RpcTestEnv struct {
	Port      int
	RpcClient *rpc.Client
	// contains filtered or unexported fields
}

func (*RpcTestEnv) ListenAndExecute

func (rpcTestEnvInstance *RpcTestEnv) ListenAndExecute(
	rcvr interface{}, rpcCallback func(*RpcTestEnv),
)

Jump to

Keyboard shortcuts

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