v1.2.3 Latest Latest

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

Go to latest
Published: Apr 26, 2021 License: Apache-2.0 Imports: 6 Imported by: 0




View Source
const Alias = "TESTER"


This section is empty.


func AssertNilHead

func AssertNilHead(t *testing.T, channel bcgo.Channel)

func NewHash

func NewHash(t *testing.T, pb proto.Message) []byte

func NewMockAccount

func NewMockAccount(t *testing.T, alias string) bcgo.Account

func NewMockBlock

func NewMockBlock(t *testing.T, timestamp uint64) *bcgo.Block

func NewMockIdentity

func NewMockIdentity(t *testing.T, alias string) bcgo.Identity

func NewMockLinkedBlock

func NewMockLinkedBlock(t *testing.T, timestamp uint64, prevHash []byte, prevBlock *bcgo.Block) *bcgo.Block

func NewMockRecord

func NewMockRecord(t *testing.T) *bcgo.Record


type MockAccount

type MockAccount struct {
	DecryptAlgorithm    cryptogo.EncryptionAlgorithm
	DecryptPayload      []byte
	DecryptPlainText    []byte
	DecryptInKey        []byte
	DecryptError        error
	DecryptKeyAlgorithm cryptogo.EncryptionAlgorithm
	DecryptKeyKey       []byte
	DecryptKeyError     error
	SignatureAlgorithm  cryptogo.SignatureAlgorithm
	Signature           []byte
	SignatureError      error

func (*MockAccount) Decrypt

func (a *MockAccount) Decrypt(algorithm cryptogo.EncryptionAlgorithm, payload, key []byte) ([]byte, error)

func (*MockAccount) DecryptKey

func (a *MockAccount) DecryptKey(algorithm cryptogo.EncryptionAlgorithm, key []byte) ([]byte, error)

func (*MockAccount) Sign

func (a *MockAccount) Sign(data []byte) (cryptogo.SignatureAlgorithm, []byte, error)

type MockCache

type MockCache struct {
	Channel            []string
	Hash               [][]byte
	Blocks             map[string]*bcgo.Block
	Heads              map[string]*bcgo.Reference
	Entries            map[string][]*bcgo.BlockEntry
	EntryTimes         []uint64
	PutHeadError       error
	PutBlockError      error
	PutBlockEntryError error
	DeleteBlockError   error
	RecordToBlock      map[string]*bcgo.Block

func NewMockCache

func NewMockCache(t *testing.T) *MockCache

func (*MockCache) Block

func (m *MockCache) Block(hash []byte) (*bcgo.Block, error)

func (*MockCache) BlockContainingRecord

func (m *MockCache) BlockContainingRecord(channel string, hash []byte) (*bcgo.Block, error)

func (*MockCache) BlockEntries

func (m *MockCache) BlockEntries(channel string, timestamp uint64) ([]*bcgo.BlockEntry, error)

func (*MockCache) Head

func (m *MockCache) Head(channel string) (*bcgo.Reference, error)

func (*MockCache) PutBlock

func (m *MockCache) PutBlock(hash []byte, block *bcgo.Block) error

func (*MockCache) PutBlockEntry

func (m *MockCache) PutBlockEntry(channel string, entry *bcgo.BlockEntry) error

func (*MockCache) PutHead

func (m *MockCache) PutHead(channel string, reference *bcgo.Reference) error

type MockChannel

type MockChannel struct {
	UpdateError, LoadError, RefreshError, PullError, PushError error
	// contains filtered or unexported fields

func NewMockChannel

func NewMockChannel(t *testing.T) *MockChannel

func (*MockChannel) AddTrigger

func (c *MockChannel) AddTrigger(func())

func (*MockChannel) AddValidator

func (c *MockChannel) AddValidator(bcgo.Validator)

func (*MockChannel) Head

func (c *MockChannel) Head() []byte

func (*MockChannel) Load

func (c *MockChannel) Load(bcgo.Cache, bcgo.Network) error

func (*MockChannel) Name

func (c *MockChannel) Name() string

func (*MockChannel) Pull

func (c *MockChannel) Pull(bcgo.Cache, bcgo.Network) error

func (*MockChannel) Push

func (c *MockChannel) Push(bcgo.Cache, bcgo.Network) error

func (*MockChannel) Refresh

func (c *MockChannel) Refresh(bcgo.Cache, bcgo.Network) error

func (*MockChannel) Set

func (c *MockChannel) Set(t uint64, h []byte)

func (*MockChannel) String

func (c *MockChannel) String() string

func (*MockChannel) Timestamp

func (c *MockChannel) Timestamp() uint64

func (*MockChannel) Update

func (c *MockChannel) Update(bcgo.Cache, bcgo.Network, []byte, *bcgo.Block) error

type MockIdentity

type MockIdentity struct {
	PublicKeyError                          error
	PlainText                               []byte
	EncryptAlgorithm                        cryptogo.EncryptionAlgorithm
	EncryptPayload                          []byte
	EncryptOutKey                           []byte
	EncryptError                            error
	EncryptKeyAlgorithm                     cryptogo.EncryptionAlgorithm
	EncryptKeyKey                           []byte
	EncryptKeyError                         error
	PlainTextKey                            []byte
	VerificationData, VerificationSignature []byte
	VerificationAlgorithm                   cryptogo.SignatureAlgorithm
	VerificationError                       error
	// contains filtered or unexported fields

func (*MockIdentity) Alias

func (a *MockIdentity) Alias() string

func (*MockIdentity) Encrypt

func (a *MockIdentity) Encrypt(payload []byte) (cryptogo.EncryptionAlgorithm, []byte, []byte, error)

func (*MockIdentity) EncryptKey

func (a *MockIdentity) EncryptKey(key []byte) (cryptogo.EncryptionAlgorithm, []byte, error)

func (*MockIdentity) PublicKey

func (a *MockIdentity) PublicKey() (cryptogo.PublicKeyFormat, []byte, error)

func (*MockIdentity) Verify

func (a *MockIdentity) Verify(algorithm cryptogo.SignatureAlgorithm, data, signature []byte) error

type MockNetwork

type MockNetwork struct {
	HeadError      error
	BlockError     error
	RecordError    error
	BroadcastError error
	Blocks         map[string]*bcgo.Block
	Heads          map[string]*bcgo.Reference
	BroadcastHash  []byte
	BroadcastBlock *bcgo.Block

func NewMockNetwork

func NewMockNetwork(t *testing.T) *MockNetwork

func (*MockNetwork) Block

func (m *MockNetwork) Block(reference *bcgo.Reference) (*bcgo.Block, error)

func (*MockNetwork) Broadcast

func (m *MockNetwork) Broadcast(channel bcgo.Channel, cache bcgo.Cache, hash []byte, block *bcgo.Block) error

func (*MockNetwork) Head

func (m *MockNetwork) Head(channel string) (*bcgo.Reference, error)

type MockValidator

type MockValidator struct {
	ValidError error

func NewMockValidator

func NewMockValidator(t *testing.T, e error) *MockValidator

func (*MockValidator) Validate

func (m *MockValidator) Validate(channel bcgo.Channel, cache bcgo.Cache, network bcgo.Network, hash []byte, block *bcgo.Block) error

Jump to

Keyboard shortcuts

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