testutil

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2024 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTestDB

func CreateTestDB(fixtures, dir string) (userdb.Backend, func(), error)

Types

type FakeAuthClient

type FakeAuthClient struct{}

func (*FakeAuthClient) Authenticate

func (c *FakeAuthClient) Authenticate(ctx context.Context, req *authpb.Request, _ ...grpc.CallOption) (*authpb.Response, error)

func (*FakeAuthClient) Logout

func (c *FakeAuthClient) Logout(_ context.Context, _ *lpb.Auth) error

type Form

type Form struct {
	Action *url.URL
	Method string
	Fields url.Values
}

func ParseForm

func ParseForm(uri *url.URL, body string) (*Form, error)

type HTTPClient

type HTTPClient struct {
	*http.Client
}

func NewClient

func NewClient() *HTTPClient

func (*HTTPClient) FormData

func (c *HTTPClient) FormData(values map[string]string) io.Reader

func (*HTTPClient) Request

func (c *HTTPClient) Request(method, uri string, r io.Reader) (string, *url.URL, error)

type UserAgent

type UserAgent struct {
	*HTTPClient
	// contains filtered or unexported fields
}

Rough approximation of a browser, used for testing.

func NewUserAgent

func NewUserAgent() *UserAgent

func (*UserAgent) Data

func (u *UserAgent) Data() string

func (*UserAgent) Request

func (u *UserAgent) Request(method, uri string, r io.Reader) error

func (*UserAgent) SubmitForm

func (u *UserAgent) SubmitForm(extraValues map[string]string) error

func (*UserAgent) URL

func (u *UserAgent) URL() *url.URL

Jump to

Keyboard shortcuts

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