assist

package
v0.0.0-...-7112f6d Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2021 License: GPL-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package assist contains testing helpers but for initialization.

Because of that, that type of funcs cannot contain *t testing.T arg on any function, so the errs are notified by log.Fatal (due every bad initialization causes bad processing).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeJsonnet

func DecodeJsonnet(name string, pointer interface{})

DecodeJsonnet will load the specified fixture and decode onto the given pointer It'll add the boilerplate of testdata/%s.jsonnet

func ReadJsonnet

func ReadJsonnet(name string) []byte

ReadJsonnet reads the jsonnet given from the specified file It'll add the boilerplate of testdata/%s.jsonnet

Types

type ExecStubber

type ExecStubber struct {
	Expect string
	Err    error
	Result driver.Result
}

ExecStubber is the actor which performs stubs of db.Exec()

func (*ExecStubber) Stub

func (exec *ExecStubber) Stub(mock sqlmock.Sqlmock) *sqlmock.ExpectedExec

Stub stubs the execution with the given mock It uses .Err to provide connection errs, and Result to stub the desired output on caller

type QueryStubber

type QueryStubber struct {
	Expect string
	Err    error
	Rows   *sqlmock.Rows
}

QueryStubber is the actor which performs stubs of db.Query()

func (*QueryStubber) Stub

func (query *QueryStubber) Stub(mock sqlmock.Sqlmock) *sqlmock.ExpectedQuery

Stub stubs the query with the given mock It uses .Err to provide connection errs, and Rows to stub the desired output on caller

Jump to

Keyboard shortcuts

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