test

package
v0.0.0-...-685a438 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package test contains functionality that should be available to all unit tests (which live in separate packages).

Index

Constants

View Source
const PostgresTestUrl = "postgresql://testuser:testpassword@localhost:5432/test"

Variables

This section is empty.

Functions

func ClearAllTestStorage

func ClearAllTestStorage()

func ClearTestStorage

func ClearTestStorage(t *testing.T, client io.Closer, storage string)

ClearTestStorage removes any output from previously run tests.

func CreateTestStorage

func CreateTestStorage(t *testing.T) string

func FindTestdataFolder

func FindTestdataFolder(t *testing.T) string

FindTestdataFolder finds the "testdata" folder which is in . or .. depending on which package is calling us.

func HTTPGet

func HTTPGet(t *testing.T, client *http.Client, url string, headers http.Header, expectedStatus int, result interface{})

func HTTPPost

func HTTPPost(t *testing.T, client *http.Client, url, body string, headers http.Header, expectedStatus int, result interface{})

func NewHTTPClient

func NewHTTPClient() *http.Client

func RunScriptOnDB

func RunScriptOnDB(t *testing.T, filename string, allowErr bool)

func SetTestStorageDir

func SetTestStorageDir(dir string)

func SetupTestStorage

func SetupTestStorage(t *testing.T) string

func StartBadHttpServer

func StartBadHttpServer(count uint32, timeout time.Duration, success string)

StartBadHttpServer starts an HTTP server that times out and returns 500 on the first few times.

func StartSchemeManagerHttpServer

func StartSchemeManagerHttpServer()

func StopBadHttpServer

func StopBadHttpServer()

func StopSchemeManagerHttpServer

func StopSchemeManagerHttpServer()

Types

type Signer

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

func LoadSigner

func LoadSigner(t *testing.T, privateKey *ecdsa.PrivateKey) *Signer

func NewSigner

func NewSigner(t *testing.T) *Signer

func (*Signer) PublicKey

func (s *Signer) PublicKey(_ string) ([]byte, error)

func (*Signer) Sign

func (s *Signer) Sign(_ string, msg []byte) ([]byte, error)

Jump to

Keyboard shortcuts

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