example

package
v0.0.0-...-ac21e34 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthFunc

func AuthFunc(ctx context.Context, payload interface{}) (interface{}, error)

AuthFunc example implementation of business logic

func AuthServer

func AuthServer(login, password, token string) *httptest.Server

AuthServer implements test auth server

func BalanceFunc

func BalanceFunc(ctx context.Context, payload interface{}) (interface{}, error)

BalanceFunc example implementation of business logic

func BalanceServer

func BalanceServer(token string, balance int) *httptest.Server

BalanceServer implements test auth server

func NewAuthTask

func NewAuthTask(id task.ID, url, login, password string) *task.Task

NewAuthTask creates auth task

func NewBalanceTask

func NewBalanceTask(id task.ID, url string, tokenKey task.ID) *task.Task

NewBalanceTask creates balance fetching task

Types

type AuthReq

type AuthReq struct {
	Login    string `json:"login"`
	Password string `json:"password"`
	// contains filtered or unexported fields
}

AuthReq auth example request

type AuthResp

type AuthResp struct {
	Status string `json:"status"`
	Token  string `json:"token"`
}

AuthResp auth example response

type BalanceReq

type BalanceReq struct {
	// contains filtered or unexported fields
}

BalanceReq example balance request

type BalanceResp

type BalanceResp struct {
	Status  string `json:"status"`
	Balance int    `json:"balance"`
}

BalanceResp example balance response

type MockedStorage

type MockedStorage struct {
	mock.Mock
}

MockedStorage mocks storage

func NewMockedStorage

func NewMockedStorage() *MockedStorage

NewMockedStorage creates MockedStorage

func (*MockedStorage) Load

func (m *MockedStorage) Load(uuid uuid.UUID) (*task.Task, error)

Load mocks task loading from storage

func (*MockedStorage) Save

func (m *MockedStorage) Save(task *task.Task) error

Save mocks task saving to storage

Jump to

Keyboard shortcuts

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