mock

package
v0.0.0-...-203b1ee Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplicationPackageDir

func ApplicationPackageDir(t *testing.T, java, cert bool) (string, string)

ApplicationPackageDir creates a mock application package directory using test helper t, returning the path to the "application" directory and the root directory where it was created. If java is true, create a file that indicates this package contains Java code. If cert is true, create an empty certificate file.

Types

type Exec

type Exec struct {
	ProgramPath    string
	CombinedOutput string
}

func (*Exec) LookPath

func (c *Exec) LookPath(name string) (string, error)

func (*Exec) Run

func (c *Exec) Run(name string, args ...string) ([]byte, error)

type HTTPClient

type HTTPClient struct {

	// LogRequests enables logging of all requests made through this client.
	LogRequests bool

	// LastRequest is the last HTTP request made through this.
	LastRequest *http.Request

	// ReadBody controls whether the client consumes the request body automatically. If true, LastBody will contain the
	// body of the most recent request.
	ReadBody bool

	// LastBody is a copy of the last request payload sent through this.
	LastBody []byte

	// Requests contains all requests made through this.
	Requests []*http.Request
	// contains filtered or unexported fields
}

func (*HTTPClient) Consumed

func (c *HTTPClient) Consumed() bool

func (*HTTPClient) Do

func (c *HTTPClient) Do(request *http.Request, timeout time.Duration) (*http.Response, error)

func (*HTTPClient) NextResponse

func (c *HTTPClient) NextResponse(response HTTPResponse)

func (*HTTPClient) NextResponseBytes

func (c *HTTPClient) NextResponseBytes(status int, body []byte)

func (*HTTPClient) NextResponseError

func (c *HTTPClient) NextResponseError(err error)

func (*HTTPClient) NextResponseString

func (c *HTTPClient) NextResponseString(status int, body string)

func (*HTTPClient) NextStatus

func (c *HTTPClient) NextStatus(status int)

type HTTPResponse

type HTTPResponse struct {
	URI    string
	Status int
	Body   []byte
	Header http.Header
}

Jump to

Keyboard shortcuts

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