clients

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AdminRole = "admin"
	UserRole  = "user"
	ThingRole = "thing"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthClientMock

type AuthClientMock struct {
	ThrowErr string
	UserId   string
	UserRole string
}

func NewAuthClientMock

func NewAuthClientMock() AuthClientMock

func (*AuthClientMock) GetAdminToken

func (c *AuthClientMock) GetAdminToken(ctx context.Context) (string, error)

GetAdminToken returns a token for an admin

func (*AuthClientMock) GetThingToken

func (c *AuthClientMock) GetThingToken(ctx context.Context, thingId string, userId string) (string, error)

GetThingToken returns a token for a thing given a user id and a thing id

func (*AuthClientMock) GetUserToken

func (c *AuthClientMock) GetUserToken(ctx context.Context, userId string) (string, error)

GetUserToken returns a token for a user

func (*AuthClientMock) IsAdmin

func (c *AuthClientMock) IsAdmin(ctx context.Context, jwt string) (bool, error)

IsAdmin checks if the user is an admin given a token

func (*AuthClientMock) IsWhichThing

func (c *AuthClientMock) IsWhichThing(ctx context.Context, jwt string) (string, error)

IsWhichThing whom a thing belong to, given a token

func (*AuthClientMock) IsWhichUser

func (c *AuthClientMock) IsWhichUser(ctx context.Context, jwt string) (string, string, error)

IsWhichUser checks if the user is a user given a token return role, user id

func (*AuthClientMock) StartAuthClient

func (c *AuthClientMock) StartAuthClient() error

StartAuthClient starts the auth client GRPC server

type NatsClientMock

type NatsClientMock struct {
	mock.Mock
}

func NewNatsClientMock

func NewNatsClientMock() NatsClientMock

func (*NatsClientMock) Connect

func (m *NatsClientMock) Connect(opts []natsGo.Option) error

func (*NatsClientMock) CreatePublisher

func (m *NatsClientMock) CreatePublisher() natsClient.NatsPubType

func (*NatsClientMock) Disconnect

func (m *NatsClientMock) Disconnect()

func (*NatsClientMock) Publish

func (m *NatsClientMock) Publish(subject string, payload string) error

func (*NatsClientMock) Subscribe

func (m *NatsClientMock) Subscribe(subject string, handler natsGo.MsgHandler) (*natsGo.Subscription, error)

type ThingsClientMock

type ThingsClientMock struct {
	mock.Mock
}

func NewThingsClientMock

func NewThingsClientMock() ThingsClientMock

func (*ThingsClientMock) GetUserOfThing

func (m *ThingsClientMock) GetUserOfThing(ctx context.Context, thingId string) (userId string, err error)

func (*ThingsClientMock) StartThingsClient

func (m *ThingsClientMock) StartThingsClient() error

Jump to

Keyboard shortcuts

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