mockdb

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2024 License: MIT Imports: 9 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)
	OnCountVASPs                func(context.Context) (uint64, error)
	OnListCertReqs              func() iterator.CertificateRequestIterator
	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
	OnCountCertReqs             func(context.Context) (uint64, error)
	OnListCerts                 func() iterator.CertificateIterator
	OnCreateCert                func(c *models.Certificate) (string, error)
	OnRetrieveCert              func(id string) (*models.Certificate, error)
	OnUpdateCert                func(c *models.Certificate) error
	OnDeleteCert                func(id string) error
	OnCountCerts                func(context.Context) (uint64, error)
	OnRetrieveAnnouncementMonth func(date string) (*bff.AnnouncementMonth, error)
	OnUpdateAnnouncementMonth   func(o *bff.AnnouncementMonth) error
	OnDeleteAnnouncementMonth   func(date string) error
	OnCountAnnouncementMonths   func(context.Context) (uint64, error)
	OnRetrieveActivityMonth     func(date string) (*bff.ActivityMonth, error)
	OnUpdateActivityMonth       func(o *bff.ActivityMonth) error
	OnDeleteActivityMonth       func(date string) error
	OnCountActivityMonths       func(context.Context) (uint64, error)
	OnListOrganizations         func() iterator.OrganizationIterator
	OnCreateOrganization        func(o *bff.Organization) (string, error)
	OnRetrieveOrganization      func(id uuid.UUID) (*bff.Organization, error)
	OnUpdateOrganization        func(o *bff.Organization) error
	OnDeleteOrganization        func(id uuid.UUID) error
	OnCountOrganizations        func(context.Context) (uint64, error)
	OnListContacts              func() []*models.Contact
	OnCreateContact             func(c *models.Contact) (string, error)
	OnRetrieveContact           func(email string) (*models.Contact, error)
	OnUpdateContact             func(c *models.Contact) error
	OnDeleteContact             func(email string) error
	OnCountContacts             func(context.Context) (uint64, 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) CountActivityMonth added in v1.7.4

func (m *MockDB) CountActivityMonth(ctx context.Context) (uint64, error)

func (*MockDB) CountAnnouncementMonths added in v1.7.4

func (m *MockDB) CountAnnouncementMonths(ctx context.Context) (uint64, error)

func (*MockDB) CountCertReqs added in v1.7.4

func (m *MockDB) CountCertReqs(ctx context.Context) (uint64, error)

func (*MockDB) CountCerts added in v1.7.4

func (m *MockDB) CountCerts(ctx context.Context) (uint64, error)

func (*MockDB) CountContacts added in v1.7.4

func (m *MockDB) CountContacts(ctx context.Context) (uint64, error)

func (*MockDB) CountOrganizations added in v1.7.4

func (m *MockDB) CountOrganizations(ctx context.Context) (uint64, error)

func (*MockDB) CountVASPs added in v1.7.4

func (m *MockDB) CountVASPs(ctx context.Context) (uint64, error)

func (*MockDB) CreateCert

func (m *MockDB) CreateCert(_ context.Context, c *models.Certificate) (string, error)

func (*MockDB) CreateCertReq

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

func (*MockDB) CreateContact added in v1.7.0

func (m *MockDB) CreateContact(_ context.Context, c *models.Contact) (string, error)

func (*MockDB) CreateOrganization added in v1.5.2

func (m *MockDB) CreateOrganization(_ context.Context, o *bff.Organization) (string, error)

func (*MockDB) CreateVASP

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

func (*MockDB) DeleteActivityMonth added in v1.7.3

func (m *MockDB) DeleteActivityMonth(_ context.Context, date string) error

func (*MockDB) DeleteAnnouncementMonth added in v1.5.3

func (m *MockDB) DeleteAnnouncementMonth(_ context.Context, date string) error

func (*MockDB) DeleteCert

func (m *MockDB) DeleteCert(_ context.Context, id string) error

func (*MockDB) DeleteCertReq

func (m *MockDB) DeleteCertReq(_ context.Context, id string) error

func (*MockDB) DeleteContact added in v1.7.0

func (m *MockDB) DeleteContact(_ context.Context, email string) error

func (*MockDB) DeleteOrganization added in v1.5.2

func (m *MockDB) DeleteOrganization(_ context.Context, id uuid.UUID) error

func (*MockDB) DeleteVASP

func (m *MockDB) DeleteVASP(_ context.Context, id string) error

func (*MockDB) ListCertReqs

func (*MockDB) ListCerts

func (*MockDB) ListContacts added in v1.7.0

func (m *MockDB) ListContacts(_ context.Context) []*models.Contact

func (*MockDB) ListOrganizations added in v1.6.1

func (m *MockDB) ListOrganizations(_ context.Context) iterator.OrganizationIterator

func (*MockDB) ListVASPs

func (*MockDB) Reindex

func (m *MockDB) Reindex() error

func (*MockDB) RetrieveActivityMonth added in v1.7.3

func (m *MockDB) RetrieveActivityMonth(_ context.Context, date string) (*bff.ActivityMonth, error)

func (*MockDB) RetrieveAnnouncementMonth added in v1.5.2

func (m *MockDB) RetrieveAnnouncementMonth(_ context.Context, date string) (*bff.AnnouncementMonth, error)

func (*MockDB) RetrieveCert

func (m *MockDB) RetrieveCert(_ context.Context, id string) (*models.Certificate, error)

func (*MockDB) RetrieveCertReq

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

func (*MockDB) RetrieveContact added in v1.7.0

func (m *MockDB) RetrieveContact(_ context.Context, email string) (*models.Contact, error)

func (*MockDB) RetrieveOrganization added in v1.5.2

func (m *MockDB) RetrieveOrganization(_ context.Context, id uuid.UUID) (*bff.Organization, error)

func (*MockDB) RetrieveVASP

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

func (*MockDB) SearchVASPs

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

func (*MockDB) UpdateActivityMonth added in v1.7.3

func (m *MockDB) UpdateActivityMonth(_ context.Context, o *bff.ActivityMonth) error

func (*MockDB) UpdateAnnouncementMonth added in v1.5.2

func (m *MockDB) UpdateAnnouncementMonth(_ context.Context, o *bff.AnnouncementMonth) error

func (*MockDB) UpdateCert

func (m *MockDB) UpdateCert(_ context.Context, c *models.Certificate) error

func (*MockDB) UpdateCertReq

func (m *MockDB) UpdateCertReq(_ context.Context, r *models.CertificateRequest) error

func (*MockDB) UpdateContact added in v1.7.0

func (m *MockDB) UpdateContact(_ context.Context, c *models.Contact) error

func (*MockDB) UpdateOrganization added in v1.5.2

func (m *MockDB) UpdateOrganization(_ context.Context, o *bff.Organization) error

func (*MockDB) UpdateVASP

func (m *MockDB) UpdateVASP(_ context.Context, 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
	CountVASPsInvoked                bool
	ListCertReqsInvoked              bool
	CreateCertReqInvoked             bool
	RetrieveCertReqInvoked           bool
	UpdateCertReqInvoked             bool
	DeleteCertReqInvoked             bool
	CountCertReqsInvoked             bool
	ListCertInvoked                  bool
	CreateCertInvoked                bool
	RetrieveCertInvoked              bool
	UpdateCertInvoked                bool
	DeleteCertInvoked                bool
	CountCertsInvoked                bool
	RetrieveAnnouncementMonthInvoked bool
	UpdateAnnouncementMonthInvoked   bool
	DeleteAnnouncementMonthInvoked   bool
	CountAnnouncementMonthsInvoked   bool
	RetrieveActivityMonthInvoked     bool
	UpdateActivityMonthInvoked       bool
	DeleteActivityMonthInvoked       bool
	CountActivityMonthsInvoked       bool
	ListOrganizationsInvoked         bool
	CreateOrganizationInvoked        bool
	RetrieveOrganizationInvoked      bool
	UpdateOrganizationInvoked        bool
	DeleteOrganizationInvoked        bool
	CountOrganizationsInvoked        bool
	ListContactsInvoked              bool
	CreateContactInvoked             bool
	RetrieveContactInvoked           bool
	UpdateContactInvoked             bool
	DeleteContactInvoked             bool
	CountContactsInvoked             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