test

package
v0.0.0-...-a002e1c Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Events = []models.Event{
	{
		DeviceId:    "esp32-2424242424",
		Description: "Maximum threshold reached",
		Type:        "temperature",
		Event:       "TEMPERATURE_MAX_THRESHOLD",
		Read:        false,
	},
	{
		DeviceId:    "esp32-4646464646",
		Description: "Minimum threshold reached",
		Type:        "temperature",
		Event:       "TEMPERATURE_MIN_THRESHOLD",
		Read:        false,
	}, {
		DeviceId:    "esp32-0123456789",
		Description: "Maximum threshold reached",
		Type:        "temperature",
		Event:       "TEMPERATURE_MAX_THRESHOLD",
		Read:        false,
	},
}

Functions

func AssertEvent

func AssertEvent(expectedResult models.Event, actualResult models.Event, t *testing.T)

func AssertEvents

func AssertEvents(expectedResult []models.Event, actualResult []models.Event, t *testing.T)

func AssertHealthCheck

func AssertHealthCheck(expectedResult HealthCheck, actualResult HealthCheck, t *testing.T)

func DbClient

func DbClient() *sql.DB

func GetEvent

func GetEvent(id string) (int, models.Event)

func GetEventResponse

func GetEventResponse(res *http.Response) (int, models.Event)

func GetEvents

func GetEvents() (int, []models.Event)

func GetEventsResponse

func GetEventsResponse(res *http.Response) (int, []models.Event)

func PutEvent

func PutEvent(id string, payload models.Event) (int, models.Event)

func PutEventResponse

func PutEventResponse(res *http.Response) (int, models.Event)

func StartServer

func StartServer() *http.Server

Types

type DbConfig

type DbConfig struct {
	Client *sql.DB
}

func (*DbConfig) CreateDbTable

func (config *DbConfig) CreateDbTable() error

func (*DbConfig) CreateEvent

func (config *DbConfig) CreateEvent(data models.Event) (models.Event, error)

func (*DbConfig) DeleteEvents

func (config *DbConfig) DeleteEvents() error

func (*DbConfig) DropDbTable

func (config *DbConfig) DropDbTable() error

type HealthCheck

type HealthCheck struct {
	Version     string `json:"version,omitempty"`
	Status      string `json:"status,omitempty"`
	Environment string `json:"environment,omitempty"`
}

func GetHealthCheck

func GetHealthCheck() (int, HealthCheck)

func GetHealthCheckResponse

func GetHealthCheckResponse(res *http.Response) (int, HealthCheck)

type SQSReceiveMessageImpl

type SQSReceiveMessageImpl struct{}

func (SQSReceiveMessageImpl) GetQueueUrl

func (dt SQSReceiveMessageImpl) GetQueueUrl(ctx context.Context,
	params *sqs.GetQueueUrlInput,
	optFns ...func(*sqs.Options)) (*sqs.GetQueueUrlOutput, error)

func (SQSReceiveMessageImpl) ReceiveMessage

func (dt SQSReceiveMessageImpl) ReceiveMessage(ctx context.Context,
	params *sqs.ReceiveMessageInput,
	optFns ...func(*sqs.Options)) (*sqs.ReceiveMessageOutput, error)

Jump to

Keyboard shortcuts

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