test

package
Version: v0.0.0-...-9a7d9fe Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// SensuCalls int
	SensuCalls int
	// SensuPostCalls int
	SensuPostCalls int
	// SensuHealthCalls int
	SensuHealthCalls int
	// SensuDeleteCalls int
	SensuDeleteCalls int
)
View Source
var (
	// GoogleChatCalls int
	GoogleChatCalls int
)
View Source
var (
	// SlackCalls int
	SlackCalls int
)
View Source
var (
	// TelegramCalls int
	TelegramCalls int
)

Functions

func InitGoogleChatMock

func InitGoogleChatMock() appcontext.Component

InitGoogleChatMock returns a MockGoogleChatRepository interface

func InitMockLogger

func InitMockLogger() appcontext.Component

InitMockLogger func creates a mock logger interface

func InitSensuMock

func InitSensuMock() appcontext.Component

InitSensuMock returns a SensuMockRepository interface

func InitSlackMock

func InitSlackMock() appcontext.Component

InitSlackMock returns a SlackMockRepository interface

func InitTelegramMock

func InitTelegramMock() appcontext.Component

InitTelegramMock returns a TelegramMockRepository interface

Types

type MockGoogleChatRepository

type MockGoogleChatRepository struct {
}

MockGoogleChatRepository struct

func (MockGoogleChatRepository) SendMessageGoogleChat

func (repo MockGoogleChatRepository) SendMessageGoogleChat(event *chat.DeprecatedEvent, content string) error

type MockLogger

type MockLogger struct {
	//Logger only supports structured logging (less features more performance)
	Logger *zap.Logger
	//Sugar supports structured and printf-style APIs (less performance more features)
	Sugar *zap.SugaredLogger
}

MockLogger wrapper with two Logger methods

func (MockLogger) DPanic

func (logger MockLogger) DPanic(args ...interface{})

DPanic uses fmt.Sprint to construct and log a message. In development, the logger then panics. (See DPanicLevel for details.)

func (MockLogger) DPanicf

func (logger MockLogger) DPanicf(template string, args ...interface{})

DPanicf uses fmt.Sprintf to log a templated message. In development, the logger then panics. (See DPanicLevel for details.)

func (MockLogger) Debug

func (logger MockLogger) Debug(args ...interface{})

Debug uses fmt.Sprint to construct and log a message.

func (MockLogger) Debugf

func (logger MockLogger) Debugf(template string, args ...interface{})

Debugf uses fmt.Sprintf to log a templated message.

func (MockLogger) Error

func (logger MockLogger) Error(args ...interface{})

Error uses fmt.Sprint to construct and log a message.

func (MockLogger) Errorf

func (logger MockLogger) Errorf(template string, args ...interface{})

Errorf uses fmt.Sprintf to log a templated message.

func (MockLogger) Fatal

func (logger MockLogger) Fatal(args ...interface{})

Fatal uses fmt.Sprint to construct and log a message, then calls os.Exit.

func (MockLogger) Fatalf

func (logger MockLogger) Fatalf(template string, args ...interface{})

Fatalf uses fmt.Sprintf to log a templated message, then calls os.Exit.

func (MockLogger) Info

func (logger MockLogger) Info(args ...interface{})

Info uses fmt.Sprint to construct and log a message.

func (MockLogger) Infof

func (logger MockLogger) Infof(template string, args ...interface{})

Infof uses fmt.Sprintf to log a templated message.

func (MockLogger) Panic

func (logger MockLogger) Panic(args ...interface{})

Panic uses fmt.Sprint to construct and log a message, then panics.

func (MockLogger) Panicf

func (logger MockLogger) Panicf(template string, args ...interface{})

Panicf uses fmt.Sprintf to log a templated message, then panics.

func (MockLogger) Sync

func (logger MockLogger) Sync()

Sync flushes the log if needed

func (MockLogger) Warn

func (logger MockLogger) Warn(args ...interface{})

Warn uses fmt.Sprint to construct and log a message.

func (MockLogger) Warnf

func (logger MockLogger) Warnf(template string, args ...interface{})

Warnf uses fmt.Sprintf to log a templated message.

type SensuMockRepository

type SensuMockRepository struct {
}

SensuMockRepository struct mock

func (SensuMockRepository) SensuDelete

func (repo SensuMockRepository) SensuDelete(sensuURL string) error

func (SensuMockRepository) SensuGet

func (repo SensuMockRepository) SensuGet(sensuurl string) ([]byte, error)

SensuGet func return []byte and error from a requested URL using a sensu api token

func (SensuMockRepository) SensuHealth

func (repo SensuMockRepository) SensuHealth(sensuurl string) bool

SensuHealth func

func (SensuMockRepository) SensuPost

func (repo SensuMockRepository) SensuPost(sensuurl string, method string, body []byte) ([]byte, error)

SensuPost func return []byte and error from a POST using sensu api token

type SlackMockRepository

type SlackMockRepository struct {
}

SlackMockRepository struct mock

func (SlackMockRepository) EphemeralFileMessage

func (repo SlackMockRepository) EphemeralFileMessage(channel string, user string, message string, title string) error

EphemeralFileMessage func send a message with attachment using channelID, userID and textMessage and return an error

func (SlackMockRepository) EphemeralMessage

func (repo SlackMockRepository) EphemeralMessage(channel string, user string, message string) error

EphemeralMessage func send a message using channelID, userID and textMessage and return an error

func (SlackMockRepository) SendMessage

func (repo SlackMockRepository) SendMessage(channel string, message, attach string) error

SendMessage func

func (SlackMockRepository) SendMessageWithImage

func (repo SlackMockRepository) SendMessageWithImage(channel string, message, textImage, imageTitle, imageURL string) error

SendMessageWithImage func

type TelegramMockRepository

type TelegramMockRepository struct {
}

TelegramMockRepository struct mock

func (TelegramMockRepository) SendTelegramMessage

func (repo TelegramMockRepository) SendTelegramMessage(reqBody []byte) error

SendTelegramMessage takes a chatID and sends answer to them

Jump to

Keyboard shortcuts

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