godropbox: github.com/dropbox/godropbox/net2/http2/test_utils Index | Files

package test_utils

import "github.com/dropbox/godropbox/net2/http2/test_utils"

Utility functions for testing net2/http2


Package Files

cert_gen.go test_utils.go

func EnsureListen Uses

func EnsureListen(c *C, hostport string)

This checks to ensure a server is running on the specified host port. DO NOT USE IN PRODUCTION.

func GenerateCertWithCA Uses

func GenerateCertWithCA(hostname string) ([]byte, []byte, []byte, error)

generate CA and certificate signed by generated CA. Returns CA's certificate, certificate, private key, error

func GenerateCertWithCAPrefs Uses

func GenerateCertWithCAPrefs(
    hostname string, lookupIps bool, expiration time.Duration) ([]byte, []byte, []byte, error)

func GenerateSelfSignedCert Uses

func GenerateSelfSignedCert(hostname string) ([]byte, []byte, error)

GenerateSelfSignedCert genereate self-signed certificate and returns public certificate in pem, private key in pem, error.

func PrivDerToPem Uses

func PrivDerToPem(priv *rsa.PrivateKey) []byte

PrivDerToPem converts rsa private key from der to pem.

func PubDerToPem Uses

func PubDerToPem(der []byte) []byte

PubDerToPem converts public key from der format to pem.

func RandomListenPort Uses

func RandomListenPort(c *C) int

This returns a random port for unit testing. DO NOT USE IN PRODUCTION.

type CustomHandler Uses

type CustomHandler struct {
    Handler func(witer http.ResponseWriter, req *http.Request)

func (*CustomHandler) ServeHTTP Uses

func (c *CustomHandler) ServeHTTP(
    writer http.ResponseWriter,
    req *http.Request)

type TestServer Uses

type TestServer struct {

    CloseChan chan bool

func SetupTestServer Uses

func SetupTestServer(ssl bool) (*TestServer, string)

Create a dummy server for unittesting. DO NOT USE IN PRODUCTION.

Package test_utils imports 11 packages (graph). Updated 2017-07-30. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).