mock

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2017 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EmptyCrawlerData

func EmptyCrawlerData() []map[string]interface{}

EmptyCrawlerData is an empty mock

func FullCrawlerData

func FullCrawlerData() []map[string]interface{}

FullCrawlerData is a mock with some data

Types

type Crawler

type Crawler struct {
	ResourceFn        func() string
	ResourceFnInvoked bool

	LastCrawledFn        func() time.Time
	LastCrawledFnInvoked bool

	DoCrawlFn        func() error
	DoCrawlFnInvoked bool

	ListFn        func(int, bool) interface{}
	ListFnInvoked bool

	GetFn        func(string) map[string]interface{}
	GetFnInvoked bool

	CountFn        func() int
	CountFnInvoked bool

	Data []map[string]interface{}
}

The Crawler mock struct holds the mocked implementation for the crawler interface

func (*Crawler) Count

func (mc *Crawler) Count() int

Count the number of resources crawled

func (*Crawler) DoCrawl

func (mc *Crawler) DoCrawl() error

DoCrawl handles the crawling

func (*Crawler) Get

func (mc *Crawler) Get(id string) map[string]interface{}

Get returns a single resource by id

func (*Crawler) LastCrawled

func (mc *Crawler) LastCrawled() time.Time

LastCrawled is the timestamp of the most recent crawl

func (*Crawler) List

func (mc *Crawler) List(limit int, expand bool) interface{}

List resources

func (*Crawler) Resource

func (mc *Crawler) Resource() string

Resource identifies the name of the crawled resource

type EC2Client

type EC2Client struct {
	DescribeInstancesFn        func(*ec2.DescribeInstancesInput) (*ec2.DescribeInstancesOutput, error)
	DescribeInstancesFnInvoked bool
}

The EC2Client struct holds the mock implementation of the EC2Client, to facilitate testing

func (*EC2Client) DescribeInstances

func (m *EC2Client) DescribeInstances(params *ec2.DescribeInstancesInput) (*ec2.DescribeInstancesOutput, error)

DescribeInstances is a mock implementation of ec2.DescribeInstances

Jump to

Keyboard shortcuts

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