Documentation ¶
Index ¶
- Constants
- func AssertNilHead(t *testing.T, channel bcgo.Channel)
- func NewHash(t *testing.T, pb proto.Message) []byte
- func NewMockAccount(t *testing.T, alias string) bcgo.Account
- func NewMockBlock(t *testing.T, timestamp uint64) *bcgo.Block
- func NewMockIdentity(t *testing.T, alias string) bcgo.Identity
- func NewMockLinkedBlock(t *testing.T, timestamp uint64, prevHash []byte, prevBlock *bcgo.Block) *bcgo.Block
- func NewMockRecord(t *testing.T) *bcgo.Record
- type MockAccount
- type MockCache
- func (m *MockCache) Block(hash []byte) (*bcgo.Block, error)
- func (m *MockCache) BlockContainingRecord(channel string, hash []byte) (*bcgo.Block, error)
- func (m *MockCache) BlockEntries(channel string, timestamp uint64) ([]*bcgo.BlockEntry, error)
- func (m *MockCache) Head(channel string) (*bcgo.Reference, error)
- func (m *MockCache) PutBlock(hash []byte, block *bcgo.Block) error
- func (m *MockCache) PutBlockEntry(channel string, entry *bcgo.BlockEntry) error
- func (m *MockCache) PutHead(channel string, reference *bcgo.Reference) error
- type MockChannel
- func (c *MockChannel) AddTrigger(func())
- func (c *MockChannel) AddValidator(bcgo.Validator)
- func (c *MockChannel) Head() []byte
- func (c *MockChannel) Load(bcgo.Cache, bcgo.Network) error
- func (c *MockChannel) Name() string
- func (c *MockChannel) Pull(bcgo.Cache, bcgo.Network) error
- func (c *MockChannel) Push(bcgo.Cache, bcgo.Network) error
- func (c *MockChannel) Refresh(bcgo.Cache, bcgo.Network) error
- func (c *MockChannel) Set(t uint64, h []byte)
- func (c *MockChannel) String() string
- func (c *MockChannel) Timestamp() uint64
- func (c *MockChannel) Update(bcgo.Cache, bcgo.Network, []byte, *bcgo.Block) error
- type MockIdentity
- func (a *MockIdentity) Alias() string
- func (a *MockIdentity) Encrypt(payload []byte) (cryptogo.EncryptionAlgorithm, []byte, []byte, error)
- func (a *MockIdentity) EncryptKey(key []byte) (cryptogo.EncryptionAlgorithm, []byte, error)
- func (a *MockIdentity) PublicKey() (cryptogo.PublicKeyFormat, []byte, error)
- func (a *MockIdentity) Verify(algorithm cryptogo.SignatureAlgorithm, data, signature []byte) error
- type MockNetwork
- type MockValidator
Constants ¶
View Source
const Alias = "TESTER"
Variables ¶
This section is empty.
Functions ¶
func NewMockLinkedBlock ¶
Types ¶
type MockAccount ¶
type MockAccount struct { MockIdentity 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 (*MockCache) BlockContainingRecord ¶
func (*MockCache) BlockEntries ¶
func (*MockCache) PutBlockEntry ¶
func (m *MockCache) PutBlockEntry(channel string, entry *bcgo.BlockEntry) 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) Name ¶
func (c *MockChannel) Name() string
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
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
type MockValidator ¶
type MockValidator struct {
ValidError error
}
func NewMockValidator ¶
func NewMockValidator(t *testing.T, e error) *MockValidator
Click to show internal directories.
Click to hide internal directories.