mocks

package
v3.7.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APNSPushQueueMock added in v0.2.0

type APNSPushQueueMock struct {
	Closed             bool
	PushedNotification *apns2.Notification
	// contains filtered or unexported fields
}

APNSPushQueueMock should be used for tests that need to send pushs to APNS.

func NewAPNSPushQueueMock added in v0.2.0

func NewAPNSPushQueueMock() *APNSPushQueueMock

NewAPNSPushQueueMock creates a new instance.

func (*APNSPushQueueMock) Close added in v0.2.0

func (m *APNSPushQueueMock) Close()

Close records that it is closed

func (*APNSPushQueueMock) Configure

func (m *APNSPushQueueMock) Configure() error

func (*APNSPushQueueMock) Push added in v0.2.0

func (m *APNSPushQueueMock) Push(n *apns2.Notification)

Push records the sent message in the MessagesSent collection

func (*APNSPushQueueMock) ResponseChannel

func (m *APNSPushQueueMock) ResponseChannel() chan *structs.ResponseWithMetadata

ResponseChannel returns responseChannel

type GCMClientMock

type GCMClientMock struct {
	MessagesSent []gcm.XMPPMessage
	Closed       bool
}

GCMClientMock should be used for tests that need to send xmpp messages to GCM

func NewGCMClientMock

func NewGCMClientMock() *GCMClientMock

NewGCMClientMock creates a new instance

func (*GCMClientMock) Close added in v0.2.0

func (m *GCMClientMock) Close() error

Close records that it is closed

func (*GCMClientMock) SendXMPP

func (m *GCMClientMock) SendXMPP(msg gcm.XMPPMessage) (string, int, error)

SendXMPP records the sent message in the MessagesSent collection

type KafkaConsumerClientMock added in v0.2.0

type KafkaConsumerClientMock struct {
	SubscribedTopics   map[string]interface{}
	EventsChan         chan kafka.Event
	AssignedPartitions []kafka.TopicPartition
	Closed             bool
	Error              error
}

KafkaConsumerClientMock should be used for tests that need to send messages to Kafka

func NewKafkaConsumerClientMock added in v0.2.0

func NewKafkaConsumerClientMock(errorOrNil ...error) *KafkaConsumerClientMock

NewKafkaConsumerClientMock creates a new instance

func (*KafkaConsumerClientMock) Assign added in v0.2.0

func (k *KafkaConsumerClientMock) Assign(partitions []kafka.TopicPartition) error

Assign mock

func (*KafkaConsumerClientMock) Close added in v0.2.0

func (k *KafkaConsumerClientMock) Close() error

Close mock

func (*KafkaConsumerClientMock) Events added in v0.2.0

func (k *KafkaConsumerClientMock) Events() chan kafka.Event

Events mock

func (*KafkaConsumerClientMock) SubscribeTopics added in v0.2.0

func (k *KafkaConsumerClientMock) SubscribeTopics(topics []string, callback kafka.RebalanceCb) error

SubscribeTopics mock

func (*KafkaConsumerClientMock) Unassign added in v0.2.0

func (k *KafkaConsumerClientMock) Unassign() error

Unassign mock

type KafkaProducerClientMock added in v0.2.0

type KafkaProducerClientMock struct {
	EventsChan   chan kafka.Event
	ProduceChan  chan *kafka.Message
	SentMessages int
}

KafkaProducerClientMock should be used for tests that need to send messages to Kafka

func NewKafkaProducerClientMock added in v0.2.0

func NewKafkaProducerClientMock() *KafkaProducerClientMock

NewKafkaProducerClientMock creates a new instance

func (*KafkaProducerClientMock) Events added in v0.2.0

func (k *KafkaProducerClientMock) Events() chan kafka.Event

Events returns the mock events channel

func (*KafkaProducerClientMock) ProduceChannel added in v0.2.0

func (k *KafkaProducerClientMock) ProduceChannel() chan *kafka.Message

ProduceChannel returns the mock produce channel

func (*KafkaProducerClientMock) StartConsumingMessagesInProduceChannel added in v0.2.0

func (k *KafkaProducerClientMock) StartConsumingMessagesInProduceChannel()

StartConsumingMessagesInProduceChannel starts to consume messages in produce channel and incrementing sentMessages

type MockEvent added in v0.2.0

type MockEvent struct {
	Message *kafka.Message
}

MockEvent implements kafka.Event

func (*MockEvent) String added in v0.2.0

func (m *MockEvent) String() string

String returns string

type PGMock added in v0.2.0

type PGMock struct {
	Execs        [][]interface{}
	ExecOnes     [][]interface{}
	Queries      [][]interface{}
	Closed       bool
	RowsAffected int
	RowsReturned int
	Error        error
}

PGMock should be used for tests that need to connect to PG

func NewPGMock added in v0.2.0

func NewPGMock(rowsAffected, rowsReturned int, errOrNil ...error) *PGMock

NewPGMock creates a new instance

func (*PGMock) Close added in v0.2.0

func (m *PGMock) Close() error

Close records that it is closed

func (*PGMock) Exec added in v0.2.0

func (m *PGMock) Exec(obj interface{}, params ...interface{}) (*types.Result, error)

Exec stores executed params

func (*PGMock) ExecOne added in v0.2.0

func (m *PGMock) ExecOne(obj interface{}, params ...interface{}) (*types.Result, error)

ExecOne stores executed params

func (*PGMock) Query added in v0.2.0

func (m *PGMock) Query(obj interface{}, query interface{}, params ...interface{}) (*types.Result, error)

Query stores executed params

type StatsDClientMock added in v0.2.0

type StatsDClientMock struct {
	Counts  map[string]int64
	Gauges  map[string]interface{}
	Timings map[string]interface{}
	Closed  bool
}

StatsDClientMock should be used for tests that need to send xmpp messages to StatsD

func NewStatsDClientMock added in v0.2.0

func NewStatsDClientMock() *StatsDClientMock

NewStatsDClientMock creates a new instance

func (*StatsDClientMock) Close added in v0.2.0

func (m *StatsDClientMock) Close() error

Close records that it is closed

func (*StatsDClientMock) Count added in v0.2.0

func (m *StatsDClientMock) Count(bucket string, value int64, tags []string, rate float64) error

Count increases a metric value by the given value

func (*StatsDClientMock) Gauge added in v0.2.0

func (m *StatsDClientMock) Gauge(bucket string, value float64, tags []string, rate float64) error

Gauge stores the count in a map

func (*StatsDClientMock) Incr

func (m *StatsDClientMock) Incr(bucket string, tags []string, rate float64) error

Incr stores the new count in a map

func (*StatsDClientMock) Timing added in v0.2.0

func (m *StatsDClientMock) Timing(bucket string, value time.Duration, tags []string, rate float64) error

Timing stores the count in a map

Jump to

Keyboard shortcuts

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