testcli

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2023 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CLI

type CLI struct {
	Env   envs.Map
	Stdin io.Reader
	// contains filtered or unexported fields
}

func New

func New(dir string) *CLI

func (*CLI) Run

func (c *CLI) Run(ctx context.Context, args ...string) (*Result, error)

func (*CLI) Start

func (c *CLI) Start(ctx context.Context, args ...string) (*Client, error)

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client for interacting with the running app

func (*Client) Close

func (c *Client) Close() error

Close the app down

func (*Client) Delete

func (c *Client) Delete(path string, body io.Reader) (*Response, error)

func (*Client) DeleteJSON

func (c *Client) DeleteJSON(path string, body io.Reader) (*Response, error)

func (*Client) DeleteRequest

func (c *Client) DeleteRequest(path string, body io.Reader) (*http.Request, error)

func (*Client) Do

func (c *Client) Do(req *http.Request) (*Response, error)

func (*Client) Get

func (c *Client) Get(path string) (*Response, error)

func (*Client) GetJSON

func (c *Client) GetJSON(path string) (*Response, error)

func (*Client) GetRequest

func (c *Client) GetRequest(path string) (*http.Request, error)

func (*Client) Hot

func (c *Client) Hot(path string) (*hot.Stream, error)

Hot connects to the event stream

func (*Client) Patch

func (c *Client) Patch(path string, body io.Reader) (*Response, error)

func (*Client) PatchJSON

func (c *Client) PatchJSON(path string, body io.Reader) (*Response, error)

func (*Client) PatchRequest

func (c *Client) PatchRequest(path string, body io.Reader) (*http.Request, error)

func (*Client) Post

func (c *Client) Post(path string, body io.Reader) (*Response, error)

func (*Client) PostJSON

func (c *Client) PostJSON(path string, body io.Reader) (*Response, error)

func (*Client) PostRequest

func (c *Client) PostRequest(path string, body io.Reader) (*http.Request, error)

func (*Client) Ready

func (c *Client) Ready(ctx context.Context) error

Wait for the application to be ready

func (*Client) Stderr

func (c *Client) Stderr() string

Stderr at a point in time

func (*Client) Stdout

func (c *Client) Stdout() string

Stdout at a point in time

func (*Client) Wait

func (c *Client) Wait() error

type Response

type Response struct {
	// contains filtered or unexported fields
}

func (*Response) Body

func (r *Response) Body() *bytes.Buffer

func (*Response) Diff

func (r *Response) Diff(expected string) error

func (*Response) DiffHeaders

func (r *Response) DiffHeaders(expected string) error

func (*Response) Dump

func (r *Response) Dump() *bytes.Buffer

Diff the response the expected HTTP response

func (*Response) Header

func (r *Response) Header(key string) string

Header gets a value from a key

func (*Response) Headers

func (r *Response) Headers() *bytes.Buffer

func (*Response) Query

func (r *Response) Query(selector string) (*goquery.Selection, error)

Query a selector on the page using goquery

func (*Response) Status

func (r *Response) Status() int

Status returns the response status

type Result

type Result struct {
	// contains filtered or unexported fields
}

func (*Result) Stderr

func (r *Result) Stderr() (stderr string)

func (*Result) Stdout

func (r *Result) Stdout() string

Jump to

Keyboard shortcuts

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