clienttest

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package clienttest ...

Package clienttest ...

Package clienttest ...

Package clienttest ...

Package clienttest ...

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HomedirServiceMock

type HomedirServiceMock struct {
	client.HomedirService
	WriteFileToUserHomeDirF    func(content []byte, pathToFile string) error
	FileExistsInUserHomeDirF   func(pathToFile string) (bool, error)
	ReadFileFromUserHomeDirF   func(pathToFile string) (string, error)
	DeleteFileFromUserHomeDirF func(pathToFile string) error
}

HomedirServiceMock ...

func DefaultHomedirServiceMock

func DefaultHomedirServiceMock() *HomedirServiceMock

DefaultHomedirServiceMock ...

func (*HomedirServiceMock) DeleteFileFromUserHomeDir

func (h *HomedirServiceMock) DeleteFileFromUserHomeDir(pathToFile string) error

DeleteFileFromUserHomeDir ...

func (*HomedirServiceMock) FileExistsInUserHomeDir

func (h *HomedirServiceMock) FileExistsInUserHomeDir(pathToFile string) (bool, error)

FileExistsInUserHomeDir ...

func (*HomedirServiceMock) ReadFileFromUserHomeDir

func (h *HomedirServiceMock) ReadFileFromUserHomeDir(pathToFile string) (string, error)

ReadFileFromUserHomeDir ...

func (*HomedirServiceMock) WriteFileToUserHomeDir

func (h *HomedirServiceMock) WriteFileToUserHomeDir(content []byte, pathToFile string) error

WriteFileToUserHomeDir ...

type ImmuClientMock

type ImmuClientMock struct {
	immuclient.ImmuClient

	GetOptionsF         func() *client.Options
	IsConnectedF        func() bool
	HealthCheckF        func(context.Context) error
	WaitForHealthCheckF func(context.Context) error
	ConnectF            func(context.Context) (*grpc.ClientConn, error)
	DisconnectF         func() error
	LoginF              func(context.Context, []byte, []byte) (*schema.LoginResponse, error)
	LogoutF             func(context.Context) error
	SafeGetF            func(context.Context, []byte, ...grpc.CallOption) (*client.VerifiedItem, error)
	SafeSetF            func(context.Context, []byte, []byte) (*client.VerifiedIndex, error)
	SetF                func(context.Context, []byte, []byte) (*schema.Index, error)
	ReferenceF          func(context.Context, []byte, []byte) (*schema.Index, error)
	SafeReferenceF      func(context.Context, []byte, []byte) (*client.VerifiedIndex, error)
	ZAddF               func(context.Context, []byte, float64, []byte) (*schema.Index, error)
	SafeZAddF           func(context.Context, []byte, float64, []byte) (*client.VerifiedIndex, error)
	HistoryF            func(context.Context, []byte) (*schema.StructuredItemList, error)
	UseDatabaseF        func(context.Context, *schema.Database) (*schema.UseDatabaseReply, error)
	DumpF               func(context.Context, io.WriteSeeker) (int64, error)
	CurrentRootF        func(context.Context) (*schema.Root, error)
	ByIndexF            func(context.Context, uint64) (*schema.StructuredItem, error)
	GetF                func(context.Context, []byte) (*schema.StructuredItem, error)
	RawSafeGetF         func(context.Context, []byte, ...grpc.CallOption) (vi *client.VerifiedItem, err error)
	RawBySafeIndexF     func(context.Context, uint64) (*client.VerifiedItem, error)
	ListUsersF          func(context.Context) (*schema.UserList, error)
	SetActiveUserF      func(context.Context, *schema.SetActiveUserRequest) error
	ChangePermissionF   func(context.Context, schema.PermissionAction, string, string, uint32) error
	ZScanF              func(context.Context, []byte) (*schema.StructuredItemList, error)
	IScanF              func(context.Context, uint64, uint64) (*schema.SPage, error)
	ScanF               func(context.Context, []byte) (*schema.StructuredItemList, error)
	CountF              func(context.Context, []byte) (*schema.ItemsCount, error)
	RawSafeSetF         func(context.Context, []byte, []byte) (vi *client.VerifiedIndex, err error)
	CreateDatabaseF     func(context.Context, *schema.Database) error
	DatabaseListF       func(context.Context) (*schema.DatabaseListResponse, error)
	ChangePasswordF     func(context.Context, []byte, []byte, []byte) error
	CreateUserF         func(context.Context, []byte, []byte, uint32, string) error
}

ImmuClientMock ...

func (*ImmuClientMock) ByIndex

func (icm *ImmuClientMock) ByIndex(ctx context.Context, index uint64) (*schema.StructuredItem, error)

ByIndex ...

func (*ImmuClientMock) ChangePassword

func (icm *ImmuClientMock) ChangePassword(ctx context.Context, user []byte, oldPass []byte, newPass []byte) error

ChangePassword ...

func (*ImmuClientMock) ChangePermission

func (icm *ImmuClientMock) ChangePermission(ctx context.Context, action schema.PermissionAction, username string, database string, permissions uint32) error

ChangePermission ...

func (*ImmuClientMock) Connect

func (icm *ImmuClientMock) Connect(ctx context.Context) (clientConn *grpc.ClientConn, err error)

Connect ...

func (*ImmuClientMock) Count

func (icm *ImmuClientMock) Count(ctx context.Context, prefix []byte) (*schema.ItemsCount, error)

Count ...

func (*ImmuClientMock) CreateDatabase

func (icm *ImmuClientMock) CreateDatabase(ctx context.Context, db *schema.Database) error

CreateDatabase ...

func (*ImmuClientMock) CreateUser

func (icm *ImmuClientMock) CreateUser(ctx context.Context, user []byte, pass []byte, permission uint32, databasename string) error

CreateUser ...

func (*ImmuClientMock) CurrentRoot

func (icm *ImmuClientMock) CurrentRoot(ctx context.Context) (*schema.Root, error)

CurrentRoot ...

func (*ImmuClientMock) DatabaseList

func (icm *ImmuClientMock) DatabaseList(ctx context.Context) (*schema.DatabaseListResponse, error)

DatabaseList ...

func (*ImmuClientMock) Disconnect

func (icm *ImmuClientMock) Disconnect() error

Disconnect ...

func (*ImmuClientMock) Dump

func (icm *ImmuClientMock) Dump(ctx context.Context, writer io.WriteSeeker) (int64, error)

Dump ...

func (*ImmuClientMock) Get

func (icm *ImmuClientMock) Get(ctx context.Context, key []byte) (*schema.StructuredItem, error)

Get ...

func (*ImmuClientMock) GetOptions

func (icm *ImmuClientMock) GetOptions() *client.Options

GetOptions ...

func (*ImmuClientMock) HealthCheck

func (icm *ImmuClientMock) HealthCheck(ctx context.Context) error

HealthCheck ...

func (*ImmuClientMock) History

func (icm *ImmuClientMock) History(ctx context.Context, key []byte) (*schema.StructuredItemList, error)

History ...

func (*ImmuClientMock) IScan

func (icm *ImmuClientMock) IScan(ctx context.Context, pageNumber uint64, pageSize uint64) (*schema.SPage, error)

IScan ...

func (*ImmuClientMock) IsConnected

func (icm *ImmuClientMock) IsConnected() bool

IsConnected ...

func (*ImmuClientMock) ListUsers

func (icm *ImmuClientMock) ListUsers(ctx context.Context) (*schema.UserList, error)

ListUsers ...

func (*ImmuClientMock) Login

func (icm *ImmuClientMock) Login(ctx context.Context, user []byte, pass []byte) (*schema.LoginResponse, error)

Login ...

func (*ImmuClientMock) Logout

func (icm *ImmuClientMock) Logout(ctx context.Context) error

Logout ...

func (*ImmuClientMock) RawBySafeIndex

func (icm *ImmuClientMock) RawBySafeIndex(ctx context.Context, index uint64) (*client.VerifiedItem, error)

RawBySafeIndex ...

func (*ImmuClientMock) RawSafeGet

func (icm *ImmuClientMock) RawSafeGet(ctx context.Context, key []byte, opts ...grpc.CallOption) (vi *client.VerifiedItem, err error)

RawSafeGet ...

func (*ImmuClientMock) RawSafeSet

func (icm *ImmuClientMock) RawSafeSet(ctx context.Context, key []byte, value []byte) (vi *client.VerifiedIndex, err error)

RawSafeSet ...

func (*ImmuClientMock) Reference

func (icm *ImmuClientMock) Reference(ctx context.Context, reference []byte, key []byte) (*schema.Index, error)

Reference ...

func (*ImmuClientMock) SafeGet

func (icm *ImmuClientMock) SafeGet(ctx context.Context, key []byte, opts ...grpc.CallOption) (*client.VerifiedItem, error)

SafeGet ...

func (*ImmuClientMock) SafeReference

func (icm *ImmuClientMock) SafeReference(ctx context.Context, reference []byte, key []byte) (*client.VerifiedIndex, error)

SafeReference ...

func (*ImmuClientMock) SafeSet

func (icm *ImmuClientMock) SafeSet(ctx context.Context, key []byte, value []byte) (*client.VerifiedIndex, error)

SafeSet ...

func (*ImmuClientMock) SafeZAdd

func (icm *ImmuClientMock) SafeZAdd(ctx context.Context, set []byte, score float64, key []byte) (*client.VerifiedIndex, error)

SafeZAdd ...

func (*ImmuClientMock) Scan

func (icm *ImmuClientMock) Scan(ctx context.Context, prefix []byte) (*schema.StructuredItemList, error)

Scan ...

func (*ImmuClientMock) Set

func (icm *ImmuClientMock) Set(ctx context.Context, key []byte, value []byte) (*schema.Index, error)

Set ...

func (*ImmuClientMock) SetActiveUser

func (icm *ImmuClientMock) SetActiveUser(ctx context.Context, u *schema.SetActiveUserRequest) error

SetActiveUser ...

func (*ImmuClientMock) UseDatabase

func (icm *ImmuClientMock) UseDatabase(ctx context.Context, d *schema.Database) (*schema.UseDatabaseReply, error)

UseDatabase ...

func (*ImmuClientMock) WaitForHealthCheck

func (icm *ImmuClientMock) WaitForHealthCheck(ctx context.Context) (err error)

WaitForHealthCheck ...

func (*ImmuClientMock) ZAdd

func (icm *ImmuClientMock) ZAdd(ctx context.Context, set []byte, score float64, key []byte) (*schema.Index, error)

ZAdd ...

func (*ImmuClientMock) ZScan

func (icm *ImmuClientMock) ZScan(ctx context.Context, set []byte) (*schema.StructuredItemList, error)

ZScan ...

type ImmuServiceClientMock added in v0.8.0

type ImmuServiceClientMock struct {
	schema.ImmuServiceClient

	ListUsersF        func(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*schema.UserList, error)
	GetUserF          func(ctx context.Context, in *schema.UserRequest, opts ...grpc.CallOption) error
	CreateUserF       func(ctx context.Context, in *schema.CreateUserRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	ChangePasswordF   func(ctx context.Context, in *schema.ChangePasswordRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	SetPermissionF    func(ctx context.Context, in *schema.Item, opts ...grpc.CallOption) (*empty.Empty, error)
	DeactivateUserF   func(ctx context.Context, in *schema.UserRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	UpdateAuthConfigF func(ctx context.Context, in *schema.AuthConfig, opts ...grpc.CallOption) (*empty.Empty, error)
	UpdateMTLSConfigF func(ctx context.Context, in *schema.MTLSConfig, opts ...grpc.CallOption) (*empty.Empty, error)
	PrintTreeF        func(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*schema.Tree, error)
	LoginF            func(ctx context.Context, in *schema.LoginRequest, opts ...grpc.CallOption) (*schema.LoginResponse, error)
	LogoutF           func(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error)
	SetF              func(ctx context.Context, in *schema.KeyValue, opts ...grpc.CallOption) (*schema.Index, error)
	SetSVF            func(ctx context.Context, in *schema.StructuredKeyValue, opts ...grpc.CallOption) (*schema.Index, error)
	SafeSetF          func(ctx context.Context, in *schema.SafeSetOptions, opts ...grpc.CallOption) (*schema.Proof, error)
	SafeSetSVF        func(ctx context.Context, in *schema.SafeSetSVOptions, opts ...grpc.CallOption) (*schema.Proof, error)
	GetF              func(ctx context.Context, in *schema.Key, opts ...grpc.CallOption) (*schema.Item, error)
	GetSVF            func(ctx context.Context, in *schema.Key, opts ...grpc.CallOption) (*schema.StructuredItem, error)
	SafeGetF          func(ctx context.Context, in *schema.SafeGetOptions, opts ...grpc.CallOption) (*schema.SafeItem, error)
	SafeGetSVF        func(ctx context.Context, in *schema.SafeGetOptions, opts ...grpc.CallOption) (*schema.SafeStructuredItem, error)
	SetBatchF         func(ctx context.Context, in *schema.KVList, opts ...grpc.CallOption) (*schema.Index, error)
	SetBatchSVF       func(ctx context.Context, in *schema.SKVList, opts ...grpc.CallOption) (*schema.Index, error)
	GetBatchF         func(ctx context.Context, in *schema.KeyList, opts ...grpc.CallOption) (*schema.ItemList, error)
	GetBatchSVF       func(ctx context.Context, in *schema.KeyList, opts ...grpc.CallOption) (*schema.StructuredItemList, error)
	ScanF             func(ctx context.Context, in *schema.ScanOptions, opts ...grpc.CallOption) (*schema.ItemList, error)
	ScanSVF           func(ctx context.Context, in *schema.ScanOptions, opts ...grpc.CallOption) (*schema.StructuredItemList, error)
	CountF            func(ctx context.Context, in *schema.KeyPrefix, opts ...grpc.CallOption) (*schema.ItemsCount, error)
	CurrentRootF      func(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*schema.Root, error)
	InclusionF        func(ctx context.Context, in *schema.Index, opts ...grpc.CallOption) (*schema.InclusionProof, error)
	ConsistencyF      func(ctx context.Context, in *schema.Index, opts ...grpc.CallOption) (*schema.ConsistencyProof, error)
	ByIndexF          func(ctx context.Context, in *schema.Index, opts ...grpc.CallOption) (*schema.Item, error)
	BySafeIndexF      func(ctx context.Context, in *schema.SafeIndexOptions, opts ...grpc.CallOption) (*schema.SafeItem, error)
	ByIndexSVF        func(ctx context.Context, in *schema.Index, opts ...grpc.CallOption) (*schema.StructuredItem, error)
	HistoryF          func(ctx context.Context, in *schema.Key, opts ...grpc.CallOption) (*schema.ItemList, error)
	HistorySVF        func(ctx context.Context, in *schema.Key, opts ...grpc.CallOption) (*schema.StructuredItemList, error)
	HealthF           func(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*schema.HealthResponse, error)
	ReferenceF        func(ctx context.Context, in *schema.ReferenceOptions, opts ...grpc.CallOption) (*schema.Index, error)
	SafeReferenceF    func(ctx context.Context, in *schema.SafeReferenceOptions, opts ...grpc.CallOption) (*schema.Proof, error)
	ZAddF             func(ctx context.Context, in *schema.ZAddOptions, opts ...grpc.CallOption) (*schema.Index, error)
	ZScanF            func(ctx context.Context, in *schema.ZScanOptions, opts ...grpc.CallOption) (*schema.ItemList, error)
	ZScanSVF          func(ctx context.Context, in *schema.ZScanOptions, opts ...grpc.CallOption) (*schema.StructuredItemList, error)
	SafeZAddF         func(ctx context.Context, in *schema.SafeZAddOptions, opts ...grpc.CallOption) (*schema.Proof, error)
	IScanF            func(ctx context.Context, in *schema.IScanOptions, opts ...grpc.CallOption) (*schema.Page, error)
	IScanSVF          func(ctx context.Context, in *schema.IScanOptions, opts ...grpc.CallOption) (*schema.SPage, error)
	DumpF             func(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (schema.ImmuService_DumpClient, error)
	CreateDatabaseF   func(ctx context.Context, in *schema.Database, opts ...grpc.CallOption) (*empty.Empty, error)
	UseDatabaseF      func(ctx context.Context, in *schema.Database, opts ...grpc.CallOption) (*schema.UseDatabaseReply, error)
	ChangePermissionF func(ctx context.Context, in *schema.ChangePermissionRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	SetActiveUserF    func(ctx context.Context, in *schema.SetActiveUserRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	DatabaseListF     func(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*schema.DatabaseListResponse, error)
}

ImmuServiceClientMock ...

func (ImmuServiceClientMock) CurrentRoot added in v0.8.0

func (iscm ImmuServiceClientMock) CurrentRoot(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*schema.Root, error)

func (ImmuServiceClientMock) DatabaseList added in v0.8.0

func (ImmuServiceClientMock) Health added in v0.8.0

func (ImmuServiceClientMock) Login added in v0.8.0

func (ImmuServiceClientMock) Logout added in v0.8.0

func (iscm ImmuServiceClientMock) Logout(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error)

func (ImmuServiceClientMock) UseDatabase added in v0.8.0

type PasswordReaderMock

type PasswordReaderMock struct {
	ReadF func(msg string) ([]byte, error)
}

PasswordReaderMock ...

func (*PasswordReaderMock) Read

func (pr *PasswordReaderMock) Read(msg string) ([]byte, error)

type TerminalReaderMock

type TerminalReaderMock struct {
	Counter             int
	Responses           []string
	ReadFromTerminalYNF func(string) (string, error)
}

TerminalReaderMock ...

func (*TerminalReaderMock) ReadFromTerminalYN

func (t *TerminalReaderMock) ReadFromTerminalYN(def string) (selected string, err error)

ReadFromTerminalYN ...

type TokenServiceMock added in v0.7.1

type TokenServiceMock struct {
	client.TokenService
	GetTokenF       func() (string, error)
	SetTokenF       func(database string, token string) error
	IsTokenPresentF func() (bool, error)
	DeleteTokenF    func() error
}

func DefaultTokenServiceMock added in v0.7.1

func DefaultTokenServiceMock() *TokenServiceMock

DefaultHomedirServiceMock ...

func (TokenServiceMock) DeleteToken added in v0.7.1

func (ts TokenServiceMock) DeleteToken() error

func (TokenServiceMock) GetDatabase added in v0.7.1

func (ts TokenServiceMock) GetDatabase() (string, error)

func (TokenServiceMock) GetToken added in v0.7.1

func (ts TokenServiceMock) GetToken() (string, error)

func (TokenServiceMock) IsTokenPresent added in v0.7.1

func (ts TokenServiceMock) IsTokenPresent() (bool, error)

func (TokenServiceMock) SetToken added in v0.7.1

func (ts TokenServiceMock) SetToken(database string, token string) error

func (TokenServiceMock) WithHds added in v0.7.1

func (TokenServiceMock) WithTokenFileName added in v0.7.1

func (ts TokenServiceMock) WithTokenFileName(tfn string) client.TokenService

Jump to

Keyboard shortcuts

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