testing

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadJSON

func ReadJSON(p string, v interface{}) error

ReadJSON reads a json file and returns it in the given interface

func ReadKeyPair

func ReadKeyPair(p string) (*bmcrypto.KeyPair, error)

ReadKeyPair reads a path to a keypair

func ReadTestFile

func ReadTestFile(p string) []byte

ReadTestFile reads a file

func ReadTestKey

func ReadTestKey(p string) (*bmcrypto.PrivKey, *bmcrypto.PubKey, error)

ReadTestKey reads a path to a keypair and returns the keys

Types

type RedisClientMock

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

RedisClientMock is a structure that can return mocked results from a redis. These results are queued by the Queue function, and fetched within the actual redis-methods. This system does not work directly when mocking redis but can be used by the redis-bridge.

func (*RedisClientMock) Del

func (r *RedisClientMock) Del(ctx context.Context, keys ...string) (int64, error)

Del deletes a key

func (*RedisClientMock) Exists

func (r *RedisClientMock) Exists(ctx context.Context, key string) (int64, error)

Exists checks if a key exists

func (*RedisClientMock) Get

func (r *RedisClientMock) Get(ctx context.Context, key string) (string, error)

Get retrieves a key

func (*RedisClientMock) Queue

func (r *RedisClientMock) Queue(f string, args ...interface{})

Queue will queue a set of return values that are returned when a specific method is called.

func (*RedisClientMock) SAdd

func (r *RedisClientMock) SAdd(ctx context.Context, key string, members ...interface{}) (int64, error)

SAdd adds to a set

func (*RedisClientMock) SMembers

func (r *RedisClientMock) SMembers(ctx context.Context, key string) ([]string, error)

SMembers returns a set

func (*RedisClientMock) SRem

func (r *RedisClientMock) SRem(ctx context.Context, key string, members ...interface{}) (int64, error)

SRem removes from a set

func (*RedisClientMock) Set

func (r *RedisClientMock) Set(ctx context.Context, key string, value interface{}, expiration time.Duration) (string, error)

Set stores a key

Jump to

Keyboard shortcuts

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