mockdb

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetStore

func GetStore() store.Store

func ResetState

func ResetState()

Types

type MockDB

type MockDB struct {
	OnClose           func() error
	OnCreateVASP      func(v *pb.VASP) (string, error)
	OnRetrieveVASP    func(id string) (*pb.VASP, error)
	OnUpdateVASP      func(v *pb.VASP) error
	OnDeleteVASP      func(id string) error
	OnListVASPs       func() iterator.DirectoryIterator
	OnSearchVASPs     func(query map[string]interface{}) ([]*pb.VASP, error)
	OnListCertReqs    func() iterator.CertificateIterator
	OnCreateCertReq   func(r *models.CertificateRequest) (string, error)
	OnRetrieveCertReq func(id string) (*models.CertificateRequest, error)
	OnUpdateCertReq   func(r *models.CertificateRequest) error
	OnDeleteCertReq   func(id string) error
	OnReindex         func() error
	OnBackup          func(string) error
}

MockDB fulfills the store interface for testing.

func (*MockDB) Backup

func (m *MockDB) Backup(path string) error

func (*MockDB) Close

func (m *MockDB) Close() error

func (*MockDB) CreateCertReq

func (m *MockDB) CreateCertReq(r *models.CertificateRequest) (string, error)

func (*MockDB) CreateVASP

func (m *MockDB) CreateVASP(v *pb.VASP) (string, error)

func (*MockDB) DeleteCertReq

func (m *MockDB) DeleteCertReq(id string) error

func (*MockDB) DeleteVASP

func (m *MockDB) DeleteVASP(id string) error

func (*MockDB) ListCertReqs

func (m *MockDB) ListCertReqs() iterator.CertificateIterator

func (*MockDB) ListVASPs

func (m *MockDB) ListVASPs() iterator.DirectoryIterator

func (*MockDB) Reindex

func (m *MockDB) Reindex() error

func (*MockDB) RetrieveCertReq

func (m *MockDB) RetrieveCertReq(id string) (*models.CertificateRequest, error)

func (*MockDB) RetrieveVASP

func (m *MockDB) RetrieveVASP(id string) (*pb.VASP, error)

func (*MockDB) SearchVASPs

func (m *MockDB) SearchVASPs(query map[string]interface{}) ([]*pb.VASP, error)

func (*MockDB) UpdateCertReq

func (m *MockDB) UpdateCertReq(r *models.CertificateRequest) error

func (*MockDB) UpdateVASP

func (m *MockDB) UpdateVASP(v *pb.VASP) error

type MockState

type MockState struct {
	// in-memory database store
	VASPs map[string]pb.VASP
	Keys  []string

	// keep track of store interface calls
	CloseInvoked           bool
	CreateVASPInvoked      bool
	RetrieveVASPInvoked    bool
	UpdateVASPInvoked      bool
	DeleteVASPInvoked      bool
	ListVASPsInvoked       bool
	SearchVASPsInvoked     bool
	ListCertReqsInvoked    bool
	CreateCertReqInvoked   bool
	RetrieveCertReqInvoked bool
	UpdateCertReqInvoked   bool
	DeleteCertReqInvoked   bool
	ReindexInvoked         bool
	BackupInvoked          bool
}

MockState contains the current state of the MockDB for test verification.

func GetState

func GetState() *MockState

Jump to

Keyboard shortcuts

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