testpoliteiad

package
v0.0.0-...-db4ab52 Latest Latest
Warning

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

Go to latest
Published: May 15, 2019 License: ISC Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TestPoliteiad

type TestPoliteiad struct {
	sync.RWMutex

	URL            string // Base url of form http://ipaddr:port
	PublicIdentity *identity.PublicIdentity
	// contains filtered or unexported fields
}

TestPoliteiad provides an implementation of the politeiad api that can be used for testing politeiad clients. The api is implemented using an httptest server and all records and plugin data is stored in memory.

func New

func New(t *testing.T, c cache.Cache) *TestPoliteiad

New returns a new TestPoliteiad context.

func (*TestPoliteiad) AddRecord

func (p *TestPoliteiad) AddRecord(t *testing.T, r v1.Record)

AddRecord adds a record to the politeiad records store and to the cache. This function is intended to be used as a way to setup test data.

func (*TestPoliteiad) Close

func (p *TestPoliteiad) Close()

Close shuts down the httptest server.

func (*TestPoliteiad) Plugin

func (p *TestPoliteiad) Plugin(t *testing.T, pc v1.PluginCommand)

Plugin is a pass through function for plugin commands. The plugin command is executed in politeiad and is then passed to the cache. This function is intended to be used as a way to setup test data.

Jump to

Keyboard shortcuts

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