pkgsite: golang.org/x/pkgsite/internal/testing/testhelper Index | Files

package testhelper

import "golang.org/x/pkgsite/internal/testing/testhelper"

Package testhelper provides shared functionality and constants to be used in Discovery tests. It should only be imported by test files.

Index

Package Files

testhelper.go

Constants

const (
    MITLicense = "" /* 1051 byte string literal not displayed */

    BSD0License = "" /* 635 byte string literal not displayed */

    UnknownLicense = `THIS IS A LICENSE THAT I JUST MADE UP. YOU CAN DO WHATEVER YOU WANT WITH THIS CODE, TRUST ME.`
)

func SetupTestClientAndServer Uses

func SetupTestClientAndServer(handler http.Handler) (*http.Client, *httptest.Server, func())

SetupTestClientAndServer returns a *httpClient that can be used to stub requests to remote hosts by redirecting all requests that the client makes to a httptest.Server. with the given handler. It also disables TLS verification.

func TestDataPath Uses

func TestDataPath(rel string) string

TestDataPath returns a path corresponding to a path relative to the calling test file. For convenience, rel is assumed to be "/"-delimited.

It panics on failure.

func ZipContents Uses

func ZipContents(contents map[string]string) ([]byte, error)

ZipContents creates an in-memory zip of the given contents.

Package testhelper imports 11 packages (graph) and is imported by 8 packages. Updated 2020-08-05. Refresh now. Tools for package owners.