Documentation ¶
Overview ¶
Package testutil provides utilities for easily making test arbor nodes and content.
Index ¶
- func MakeCommunityOrSkip(t *testing.T) (*forest.Identity, forest.Signer, *forest.Community)
- func MakeIdentityFromKeyOrSkip(t *testing.T, privKey, passphrase string) (*forest.Identity, forest.Signer)
- func MakeIdentityOrSkip(t *testing.T) (*forest.Identity, forest.Signer)
- func MakeReplyOrSkip(t *testing.T) (*forest.Identity, forest.Signer, *forest.Community, *forest.Reply)
- func MockCommunity(identity *forest.Builder, name string) *forest.Community
- func MockIdentity() (*forest.Identity, forest.Signer)
- func MockReply(identity *forest.Builder, parent forest.Node) *forest.Reply
- func QualifiedContentOrSkip(t *testing.T, contentType fields.ContentType, content []byte) *fields.QualifiedContent
- func RandomBytes(length int) []byte
- func RandomIdentity(t *testing.T) *forest.Identity
- func RandomNodeSlice(length int, t *testing.T) ([]*fields.QualifiedHash, []forest.Node)
- func RandomQualifiedHash() *fields.QualifiedHash
- func RandomQualifiedHashSlice(count int) []*fields.QualifiedHash
- func RandomString(length int) string
- func SetupStore(t *testing.T, prefix, name string, init Initializer, nodes ...forest.Node) forest.Store
- type Initializer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeCommunityOrSkip ¶
func MakeIdentityOrSkip ¶
func MakeReplyOrSkip ¶
func MockCommunity ¶
func MockCommunity(identity *forest.Builder, name string) *forest.Community
MockCommunity creates a fake community for the purposes of testing.
func MockIdentity ¶
func MockIdentity() (*forest.Identity, forest.Signer)
MockIdentity creates a fake identity with a random name for the purposes of testing.
func MockReply ¶
func MockReply( identity *forest.Builder, parent forest.Node, ) *forest.Reply
MockReply creates a fake reply with random content for the given identity and community.
func QualifiedContentOrSkip ¶
func QualifiedContentOrSkip(t *testing.T, contentType fields.ContentType, content []byte) *fields.QualifiedContent
func RandomBytes ¶
func RandomIdentity ¶
func RandomNodeSlice ¶
func RandomNodeSlice(length int, t *testing.T) ([]*fields.QualifiedHash, []forest.Node)
func RandomQualifiedHash ¶
func RandomQualifiedHash() *fields.QualifiedHash
func RandomQualifiedHashSlice ¶
func RandomQualifiedHashSlice(count int) []*fields.QualifiedHash
func RandomString ¶
func SetupStore ¶
func SetupStore( t *testing.T, prefix, name string, init Initializer, nodes ...forest.Node, ) forest.Store
SetupStore creates an orchard using a unique temporary file. After the run, database files are moved to a known location with the specified prefix to disambiguate between test runs.
Types ¶
type Initializer ¶
Initializer creates a store at the specified path.
Click to show internal directories.
Click to hide internal directories.