tests

package
v0.0.0-...-5404be9 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

Get does an HTTP GET request against an HTTP handler

func GetWithHeaders

func GetWithHeaders(r http.Handler, path string, headers map[string]string) *httptest.ResponseRecorder

GetWithHeaders does an HTTP GET request with custom headers against an HTTP handler

func Post

func Post(r http.Handler, path, body string) *httptest.ResponseRecorder

Post does an HTTP POST request against an HTTP handler

func SetGinContext

func SetGinContext(r *gin.Engine, ctxs map[string]interface{})

SetGinContext sets custom Gin contexts

Types

type MockedCache

type MockedCache struct {
	mock.Mock
}

MockedCache is a dummy cache handler

func (*MockedCache) HGet

func (m *MockedCache) HGet(key, field string) (string, error)

HGet mocks the same redis.Client method

func (*MockedCache) HGetAll

func (m *MockedCache) HGetAll(key string) (map[string]string, error)

HGetAll mocks the same redis.Client method

func (*MockedCache) HSet

func (m *MockedCache) HSet(key, field string, value interface{}) (bool, error)

HSet mocks the same redis.Client method

func (*MockedCache) SCard

func (m *MockedCache) SCard(key string) (int64, error)

SCard mocks the same redis.Client method

func (*MockedCache) SIsMember

func (m *MockedCache) SIsMember(key string, member interface{}) (bool, error)

SIsMember mocks the same redis.Client method

func (*MockedCache) SMembers

func (m *MockedCache) SMembers(key string) ([]string, error)

SMembers mocks the same redis.Client method

func (*MockedCache) TxPipeline

func (m *MockedCache) TxPipeline() redis.Pipeliner

TxPipeline mocks the same redis.Client method

func (*MockedCache) Z

func (m *MockedCache) Z(score float64, member interface{}) redis.Z

Z mocks the redis.Z struct

func (*MockedCache) ZRangeByScore

func (m *MockedCache) ZRangeByScore(key string, opt redis.ZRangeBy) ([]string, error)

ZRangeByScore mocks the same redis.Client method

type MockedDatabase

type MockedDatabase struct {
	mock.Mock
}

MockedDatabase is a dummy database handler

func (*MockedDatabase) Exec

func (m *MockedDatabase) Exec(q string, a ...interface{}) (sql.Result, error)

Exec mocks the same sql.DB method

func (*MockedDatabase) Get

func (m *MockedDatabase) Get(d interface{}, q string, a ...interface{}) error

Get mocks the same sqlx.DB method

func (*MockedDatabase) Select

func (m *MockedDatabase) Select(d interface{}, q string, a ...interface{}) error

Select mocks the same sqlx.DB method

Jump to

Keyboard shortcuts

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