testbase

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2023 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TestVaultID           = "Z2kcCarCE47SDjtWD5ruyijsQyWMF5B1jjk6HHWngoe"
	TestVaultName         = "memory"
	TestOffChainStorageID = "28HADuAnDmLghgFTk7wppqmSrPMGV1LkQeJBNN9U3U8r"
	IndexStoreID          = "did:piprate:8mMVQNNz3E94JBtWvibyy745eZYBK3CnoLdFaQY33jd5"
	IndexStoreName        = "test_store"

	TestAccountClientSecretString = "4c6KgcjSnKSgTbW/lUgb1cx8SujjkP+1C4lNlrm9mQU=" //nolint:gosec
	TestAccountPassword           = "pass123"
	TestLockerID                  = "5bYpBwLVgXpnwgX1XGaNf6JX87KaEHMfd8fqGt4Jo6aB"
)

Variables

View Source
var (
	TestAccountRootDID        *model.DID
	TestAccountClientSecret   *model.AESKey
	TestAccountID             string
	TestAccountRecoveryPhrase string
)

Functions

func AssertEqualJSON

func AssertEqualJSON(t *testing.T, expectedDoc, actualDoc any) (bool, []byte)

func AssertEqualUnorderedJSON

func AssertEqualUnorderedJSON(t *testing.T, expectedDoc, actualDoc any) (bool, []byte)

func NewInMemoryVault

func NewInMemoryVault(t *testing.T, vaultID, vaultName string, sse, cas bool, verifier model.AccessVerifier) (vaults.Vault, *vaults.Config)

func SetupLogFormat

func SetupLogFormat()

func TestBlobManager

func TestBlobManager(t *testing.T, cas bool, verifier model.AccessVerifier) *vaults.LocalBlobManager

func TestDID

func TestDID(t *testing.T) *model.DID

func TestUniLocker

func TestUniLocker(t *testing.T) *model.Locker

Types

type CustomFn

type CustomFn func(x any) bool

type DynamicMatcher

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

DynamicMatcher can be used with gomock to check for conditions dynamically Standard gomock matchers offer a limited set of comparison options

func NewDynamicMatcher

func NewDynamicMatcher(fn CustomFn, desc string) *DynamicMatcher

func (DynamicMatcher) Matches

func (dm DynamicMatcher) Matches(x any) bool

func (DynamicMatcher) String

func (dm DynamicMatcher) String() string

type MockDataSet

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

func NewMockDataSet

func NewMockDataSet(r *model.Record, lease *model.Lease, blockNumber int64, lockerID, participantID string, meta any) *MockDataSet

func (*MockDataSet) AddMockLeaseFromFile

func (d *MockDataSet) AddMockLeaseFromFile(t *testing.T, id string, filename string)

func (*MockDataSet) BlockNumber

func (d *MockDataSet) BlockNumber() int64

func (*MockDataSet) DecodeMetaResource

func (d *MockDataSet) DecodeMetaResource(obj any) error

func (*MockDataSet) DecodeResource

func (d *MockDataSet) DecodeResource(id string, obj any) error

func (*MockDataSet) ID

func (d *MockDataSet) ID() string

func (*MockDataSet) Impression

func (d *MockDataSet) Impression() *model.Impression

func (*MockDataSet) Lease

func (d *MockDataSet) Lease() *model.Lease

func (*MockDataSet) LockerID

func (d *MockDataSet) LockerID() string

func (*MockDataSet) MetaResource

func (d *MockDataSet) MetaResource() (io.ReadCloser, error)

func (*MockDataSet) ParticipantID

func (d *MockDataSet) ParticipantID() string

func (*MockDataSet) Record

func (d *MockDataSet) Record() *model.Record

func (*MockDataSet) Resource

func (d *MockDataSet) Resource(id string) (io.ReadCloser, error)

func (*MockDataSet) Resources

func (d *MockDataSet) Resources() []string

type TestMetaLockerEnvironment

type TestMetaLockerEnvironment struct {
	IdentityBackend storage.IdentityBackend
	BlobManager     *vaults.LocalBlobManager
	IndexStore      index.Store
	IndexClient     index.Client
	OffChainStorage model.OffChainStorage
	NS              notification.Service
	Ledger          model.Ledger
	Factory         *wallet.LocalFactory
	Router          *gin.Engine
	TempDir         string
	ExtraServices   map[string]any
}

func SetUpTestEnvironment

func SetUpTestEnvironment(t *testing.T) *TestMetaLockerEnvironment

func (*TestMetaLockerEnvironment) Close

func (env *TestMetaLockerEnvironment) Close() error

func (*TestMetaLockerEnvironment) CreateCustomAccount

func (env *TestMetaLockerEnvironment) CreateCustomAccount(t *testing.T, email, name string, lvl model.AccessLevel, rootIdentityOptions ...model.DIDOption) wallet.DataWallet

func (*TestMetaLockerEnvironment) CreateDataWallet

func (env *TestMetaLockerEnvironment) CreateDataWallet(t *testing.T, acct *account.Account) wallet.DataWallet

func (*TestMetaLockerEnvironment) CreateTestManagedAccount

func (env *TestMetaLockerEnvironment) CreateTestManagedAccount(t *testing.T) wallet.DataWallet

func (*TestMetaLockerEnvironment) SetUpTestScenario1

func (env *TestMetaLockerEnvironment) SetUpTestScenario1(t *testing.T)

func (*TestMetaLockerEnvironment) TestScenario1Context

func (env *TestMetaLockerEnvironment) TestScenario1Context() *gin.Context

type TestTracker

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

func StartTestTracker

func StartTestTracker(t *testing.T) *TestTracker

func (*TestTracker) Finish

func (tt *TestTracker) Finish()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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