mockgetter

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2018 License: MIT Imports: 5 Imported by: 0

README

mockgetter.Getter

Very simple mock for basic tests, returns a given page after a specified timeout

Documentation

Overview

Package mockgetter defines a getter.Interface that returns mock results for use in tests

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dummy

type Dummy struct {
	Body    string        // Contents of the body as a string
	Code    int           // Response code
	Latency time.Duration // Time to wait before returning
	Err     error         // Error to return
}

Dummy contains information about the result

type Getter

type Getter struct {
	Results map[string]Dummy // The results to return: url -> result
}

Getter is a getter.Interface that returns results mock results for use in tests

func (*Getter) Get

func (h *Getter) Get(ctx context.Context, url string) chan getter.Result

Get returns a channel. Later it sends the response, and closes the channel.

Jump to

Keyboard shortcuts

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