mocks

package
v0.0.0-...-bbebf15 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package mocks contains mocks for testing purposes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDefinition

func CreateDefinition(channels, subtopics []string) twins.Definition

CreateDefinition creates twin definition.

func CreateMessage

func CreateMessage(attr twins.Attribute, recs []senml.Record) (*messaging.Message, error)

CreateMessage creates Magistrala message using SenML record array.

func CreateTwin

func CreateTwin(channels, subtopics []string) twins.Twin

CreateTwin creates twin.

func NewBroker

func NewBroker(sub map[string]string) messaging.Publisher

NewBroker returns mock message publisher.

Types

type Service

type Service struct {
	mock.Mock
}

Service is an autogenerated mock type for the Service type

func NewService

func NewService(t interface {
	mock.TestingT
	Cleanup(func())
}) *Service

NewService creates a new instance of Service. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*Service) AddTwin

func (_m *Service) AddTwin(ctx context.Context, token string, twin twins.Twin, def twins.Definition) (twins.Twin, error)

AddTwin provides a mock function with given fields: ctx, token, twin, def

func (*Service) ListStates

func (_m *Service) ListStates(ctx context.Context, token string, offset uint64, limit uint64, twinID string) (twins.StatesPage, error)

ListStates provides a mock function with given fields: ctx, token, offset, limit, twinID

func (*Service) ListTwins

func (_m *Service) ListTwins(ctx context.Context, token string, offset uint64, limit uint64, name string, metadata twins.Metadata) (twins.Page, error)

ListTwins provides a mock function with given fields: ctx, token, offset, limit, name, metadata

func (*Service) RemoveTwin

func (_m *Service) RemoveTwin(ctx context.Context, token string, twinID string) error

RemoveTwin provides a mock function with given fields: ctx, token, twinID

func (*Service) SaveStates

func (_m *Service) SaveStates(ctx context.Context, msg *messaging.Message) error

SaveStates provides a mock function with given fields: ctx, msg

func (*Service) UpdateTwin

func (_m *Service) UpdateTwin(ctx context.Context, token string, twin twins.Twin, def twins.Definition) error

UpdateTwin provides a mock function with given fields: ctx, token, twin, def

func (*Service) ViewTwin

func (_m *Service) ViewTwin(ctx context.Context, token string, twinID string) (twins.Twin, error)

ViewTwin provides a mock function with given fields: ctx, token, twinID

type StateRepository

type StateRepository struct {
	mock.Mock
}

StateRepository is an autogenerated mock type for the StateRepository type

func NewStateRepository

func NewStateRepository(t interface {
	mock.TestingT
	Cleanup(func())
}) *StateRepository

NewStateRepository creates a new instance of StateRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*StateRepository) Count

func (_m *StateRepository) Count(ctx context.Context, twin twins.Twin) (int64, error)

Count provides a mock function with given fields: ctx, twin

func (*StateRepository) RetrieveAll

func (_m *StateRepository) RetrieveAll(ctx context.Context, offset uint64, limit uint64, twinID string) (twins.StatesPage, error)

RetrieveAll provides a mock function with given fields: ctx, offset, limit, twinID

func (*StateRepository) RetrieveLast

func (_m *StateRepository) RetrieveLast(ctx context.Context, twinID string) (twins.State, error)

RetrieveLast provides a mock function with given fields: ctx, twinID

func (*StateRepository) Save

func (_m *StateRepository) Save(ctx context.Context, state twins.State) error

Save provides a mock function with given fields: ctx, state

func (*StateRepository) Update

func (_m *StateRepository) Update(ctx context.Context, state twins.State) error

Update provides a mock function with given fields: ctx, state

type TwinCache

type TwinCache struct {
	mock.Mock
}

TwinCache is an autogenerated mock type for the TwinCache type

func NewTwinCache

func NewTwinCache(t interface {
	mock.TestingT
	Cleanup(func())
}) *TwinCache

NewTwinCache creates a new instance of TwinCache. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*TwinCache) IDs

func (_m *TwinCache) IDs(ctx context.Context, channel string, subtopic string) ([]string, error)

IDs provides a mock function with given fields: ctx, channel, subtopic

func (*TwinCache) Remove

func (_m *TwinCache) Remove(ctx context.Context, twinID string) error

Remove provides a mock function with given fields: ctx, twinID

func (*TwinCache) Save

func (_m *TwinCache) Save(ctx context.Context, twin twins.Twin) error

Save provides a mock function with given fields: ctx, twin

func (*TwinCache) SaveIDs

func (_m *TwinCache) SaveIDs(ctx context.Context, channel string, subtopic string, twinIDs []string) error

SaveIDs provides a mock function with given fields: ctx, channel, subtopic, twinIDs

func (*TwinCache) Update

func (_m *TwinCache) Update(ctx context.Context, twin twins.Twin) error

Update provides a mock function with given fields: ctx, twin

type TwinRepository

type TwinRepository struct {
	mock.Mock
}

TwinRepository is an autogenerated mock type for the TwinRepository type

func NewTwinRepository

func NewTwinRepository(t interface {
	mock.TestingT
	Cleanup(func())
}) *TwinRepository

NewTwinRepository creates a new instance of TwinRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*TwinRepository) Remove

func (_m *TwinRepository) Remove(ctx context.Context, twinID string) error

Remove provides a mock function with given fields: ctx, twinID

func (*TwinRepository) RetrieveAll

func (_m *TwinRepository) RetrieveAll(ctx context.Context, owner string, offset uint64, limit uint64, name string, metadata twins.Metadata) (twins.Page, error)

RetrieveAll provides a mock function with given fields: ctx, owner, offset, limit, name, metadata

func (*TwinRepository) RetrieveByAttribute

func (_m *TwinRepository) RetrieveByAttribute(ctx context.Context, channel string, subtopic string) ([]string, error)

RetrieveByAttribute provides a mock function with given fields: ctx, channel, subtopic

func (*TwinRepository) RetrieveByID

func (_m *TwinRepository) RetrieveByID(ctx context.Context, twinID string) (twins.Twin, error)

RetrieveByID provides a mock function with given fields: ctx, twinID

func (*TwinRepository) Save

func (_m *TwinRepository) Save(ctx context.Context, twin twins.Twin) (string, error)

Save provides a mock function with given fields: ctx, twin

func (*TwinRepository) Update

func (_m *TwinRepository) Update(ctx context.Context, twin twins.Twin) error

Update provides a mock function with given fields: ctx, twin

Jump to

Keyboard shortcuts

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