apitest

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package apitest provides utilities to test api

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Diff

func Diff(a interface{}, b interface{}) string

Diff which handles Record comparison in sorted order

func MarshalFile

func MarshalFile(t *testing.T, o interface{}, filename string)

func TestSource

func TestSource(t *testing.T, tt *TestSourceConfig)

TestSource compares the result of converting a given struct to api.Records

func UnmarshalFile

func UnmarshalFile(t *testing.T, filename string, o interface{})

Types

type Recorder

type Recorder struct {
	Records []*api.Record
	sync.Mutex
}

func (*Recorder) ReadFrom

func (r *Recorder) ReadFrom(ctx context.Context, ch <-chan *api.Record) error

type TestSourceConfig

type TestSourceConfig struct {
	api.Source
	InputFile  string
	OutputFile string
	Update     bool
}

Jump to

Keyboard shortcuts

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